Neat! Is it conventional in HTTP libraries in other languages to use the indexing operator? I can see the appeal but I might also argue for `res.header("foo")` for clarity's sake.
-
-
-
We support both! The reasoning is that like with HashMap and Vec there's value in having a way to index that returns Option, and another which unwraps.
- 7 more replies
New conversation -
-
-
What happens if the header is not present ? (The “[]” traditionally panics on that, right ?) Also, what happens if the header is present twice ?
-
We return a custom type that's the equivalent of a Vec of headers; comparing to a string slice is a convenient PartialEq impl. If a header is not present it'll indeed panic. Headers::get) is the non-panic variant (similar to HashMap::get).
- 5 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.