http-types
http-types copied to clipboard
Common types for HTTP operations
On read as body is big file, read_to_end is too slowly. Therefor capacity depends on Body.len() like a into_string()
Overhauls errors to allow for 3 types of errors: - Concrete errors (enum) from http-types itself - A dynamic error type for response handlers (almost identical to how `Error` was...
Tracking issue: #274 I saw akka refers to this as [`MediaType`](https://doc.akka.io/api/akka-http/10.0/akka/http/scaladsl/model/MediaTypes.html) and quite liked it. "MIME" is pretty nondescript if you don't know what it is I'm advance. "Media type"...
This allows HeaderValue to borrow `'static` strings, rather than make allocations. Unfortunately, we can't specialize `TryFrom` or `From`, so this also adds a new crate-only `from_static_str() -> HeaderValue`.
Right now conversion from `http::StatusCode` (which is just an `u16` in `100..=600` range) to `StatusCode` just expect()s the result for example here: https://github.com/http-rs/http-types/blob/539638273de768a24354b65999ad9317b6659204/src/response.rs#L101-L103 this could cause a crash in response...
This contains some of the earliest work on typed headers, and precedes the cohesive design push we've initiated since. This makes it likely that the work there doesn't conform to...
To: ```rust res.insert_header(&typed_header); res.insert_header(("headerName", "headerValue")); ```