diff options
Diffstat (limited to 'cli/http_util.rs')
-rw-r--r-- | cli/http_util.rs | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/cli/http_util.rs b/cli/http_util.rs index 7da2c7dbd..c24792a7f 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -3,15 +3,12 @@ use crate::deno_error; use crate::deno_error::DenoError; use crate::deno_error::ErrorKind; use crate::version; -use brotli2::read::BrotliDecoder; use bytes::Bytes; use deno_core::ErrBox; use futures::future::FutureExt; use reqwest; use reqwest::header::HeaderMap; use reqwest::header::HeaderValue; -use reqwest::header::ACCEPT_ENCODING; -use reqwest::header::CONTENT_ENCODING; use reqwest::header::IF_NONE_MATCH; use reqwest::header::LOCATION; use reqwest::header::USER_AGENT; @@ -107,9 +104,7 @@ pub fn fetch_once( let url = url.clone(); let fut = async move { - let mut request = client - .get(url.clone()) - .header(ACCEPT_ENCODING, HeaderValue::from_static("gzip, br")); + let mut request = client.get(url.clone()); if let Some(etag) = cached_etag { let if_none_match_val = HeaderValue::from_str(&etag).unwrap(); @@ -157,26 +152,7 @@ pub fn fetch_once( return Err(err.into()); } - let content_encoding = response - .headers() - .get(CONTENT_ENCODING) - .map(|content_encoding| content_encoding.to_str().unwrap().to_owned()); - - let body; - if let Some(content_encoding) = content_encoding { - body = match content_encoding { - _ if content_encoding == "br" => { - let full_bytes = response.bytes().await?; - let mut decoder = BrotliDecoder::new(full_bytes.as_ref()); - let mut body = vec![]; - decoder.read_to_end(&mut body)?; - body - } - _ => response.bytes().await?.to_vec(), - } - } else { - body = response.bytes().await?.to_vec(); - } + let body = response.bytes().await?.to_vec(); return Ok(FetchOnceResult::Code(body, headers_)); }; |