mirror of
https://github.com/denoland/deno.git
synced 2025-08-31 15:57:53 +00:00
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
This commit is contained in:
parent
33acd437f5
commit
c2414db1f6
33 changed files with 252 additions and 256 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue