Enable brotli for blocking (#1061)
This commit is contained in:
@@ -206,6 +206,25 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.gzip(enable))
|
self.with_inner(|inner| inner.gzip(enable))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Enable auto brotli decompression by checking the `Content-Encoding` response header.
|
||||||
|
///
|
||||||
|
/// If auto brotli decompression is turned on:
|
||||||
|
///
|
||||||
|
/// - When sending a request and if the request's headers do not already contain
|
||||||
|
/// an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `br`.
|
||||||
|
/// The request body is **not** automatically compressed.
|
||||||
|
/// - When receiving a response, if it's headers contain a `Content-Encoding` value that
|
||||||
|
/// equals to `br`, both values `Content-Encoding` and `Content-Length` are removed from the
|
||||||
|
/// headers' set. The response body is automatically decompressed.
|
||||||
|
///
|
||||||
|
/// If the `brotli` feature is turned on, the default option is enabled.
|
||||||
|
///
|
||||||
|
/// # Optional
|
||||||
|
///
|
||||||
|
/// This requires the optional `brotli` feature to be enabled
|
||||||
|
#[cfg(feature = "brotli")]
|
||||||
|
pub fn brotli(self, enable: bool) -> ClientBuilder { self.with_inner(|inner| inner.brotli(enable)) }
|
||||||
|
|
||||||
/// Disable auto response body gzip decompression.
|
/// Disable auto response body gzip decompression.
|
||||||
///
|
///
|
||||||
/// This method exists even if the optional `gzip` feature is not enabled.
|
/// This method exists even if the optional `gzip` feature is not enabled.
|
||||||
@@ -215,6 +234,13 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.no_gzip())
|
self.with_inner(|inner| inner.no_gzip())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Disable auto response body brotli decompression.
|
||||||
|
///
|
||||||
|
/// This method exists even if the optional `brotli` feature is not enabled.
|
||||||
|
/// This can be used to ensure a `Client` doesn't use brotli decompression
|
||||||
|
/// even if another dependency were to enable the optional `brotli` feature.
|
||||||
|
pub fn no_brotli(self) -> ClientBuilder { self.with_inner(|inner| inner.no_brotli()) }
|
||||||
|
|
||||||
// Redirect options
|
// Redirect options
|
||||||
|
|
||||||
/// Set a `redirect::Policy` for this client.
|
/// Set a `redirect::Policy` for this client.
|
||||||
|
|||||||
Reference in New Issue
Block a user