diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-12-27 17:59:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 11:59:57 -0500 |
commit | c2414db1f68d27db8ca6f192f0ff877f1394164c (patch) | |
tree | 528da9796f400557204bfdb8e4d44d64173036ce /ext/http/fly_accept_encoding.rs | |
parent | 33acd437f52b418a8413a302dd8902abad2eabec (diff) |
refactor: simplify hyper, http, h2 deps (#21715)
Main change is that:
- "hyper" has been renamed to "hyper_v014" to signal that it's legacy
- "hyper1" has been renamed to "hyper" and should be the default
Diffstat (limited to 'ext/http/fly_accept_encoding.rs')
-rw-r--r-- | ext/http/fly_accept_encoding.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/http/fly_accept_encoding.rs b/ext/http/fly_accept_encoding.rs index af687c254..d48410d41 100644 --- a/ext/http/fly_accept_encoding.rs +++ b/ext/http/fly_accept_encoding.rs @@ -3,7 +3,6 @@ // Forked from https://github.com/superfly/accept-encoding/blob/1cded757ec7ff3916e5bfe7441db76cdc48170dc/ // Forked to support both http 0.3 and http 1.0 crates. -use http as http_02; use itertools::Itertools; /// A list enumerating the categories of errors in this crate. @@ -78,10 +77,10 @@ pub fn preferred( /// /// Compatible with `http` crate for version 0.2.x. pub fn encodings_iter_http_02( - headers: &http_02::HeaderMap, + headers: &http_v02::HeaderMap, ) -> impl Iterator<Item = Result<(Option<Encoding>, f32), EncodingError>> + '_ { let iter = headers - .get_all(http_02::header::ACCEPT_ENCODING) + .get_all(http_v02::header::ACCEPT_ENCODING) .iter() .map(|hval| hval.to_str().map_err(|_| EncodingError::InvalidEncoding)); encodings_iter_inner(iter) @@ -91,10 +90,10 @@ pub fn encodings_iter_http_02( /// /// Compatible with `http` crate for version 1.x. pub fn encodings_iter_http_1( - headers: &http_1::HeaderMap, + headers: &http::HeaderMap, ) -> impl Iterator<Item = Result<(Option<Encoding>, f32), EncodingError>> + '_ { let iter = headers - .get_all(http_1::header::ACCEPT_ENCODING) + .get_all(http::header::ACCEPT_ENCODING) .iter() .map(|hval| hval.to_str().map_err(|_| EncodingError::InvalidEncoding)); encodings_iter_inner(iter) @@ -126,9 +125,9 @@ fn encodings_iter_inner<'s>( #[cfg(test)] mod tests { use super::*; - use http::header::ACCEPT_ENCODING; - use http::HeaderMap; - use http::HeaderValue; + use http_v02::header::ACCEPT_ENCODING; + use http_v02::HeaderMap; + use http_v02::HeaderValue; fn encodings( headers: &HeaderMap, |