diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index 83bb722..9ae6cc9 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -78,6 +78,7 @@ struct Config { #[cfg(feature = "tls")] tls: TlsBackend, http2_only: bool, + http1_title_case_headers: bool, local_address: Option, } @@ -110,6 +111,7 @@ impl ClientBuilder { #[cfg(feature = "tls")] tls: TlsBackend::default(), http2_only: false, + http1_title_case_headers: false, local_address: None, }, } @@ -186,6 +188,10 @@ impl ClientBuilder { builder.http2_only(true); } + if config.http1_title_case_headers { + builder.http1_title_case_headers(true); + } + let hyper_client = builder.build(connector); let proxies_maybe_http_auth = proxies @@ -329,6 +335,12 @@ impl ClientBuilder { self } + /// Enable case sensitive headers. + pub fn http1_title_case_headers(mut self) -> ClientBuilder { + self.config.http1_title_case_headers = true; + self + } + /// Set a timeout for only the connect phase of a `Client`. /// /// Default is `None`. diff --git a/src/client.rs b/src/client.rs index 16a60b7..83d7ad0 100644 --- a/src/client.rs +++ b/src/client.rs @@ -324,6 +324,19 @@ impl ClientBuilder { self.with_inner(|inner| inner.h2_prior_knowledge()) } + /// Enable case sensitive headers. + /// + /// # Example + /// + /// ``` + /// let client = reqwest::Client::builder() + /// .http1_title_case_headers() + /// .build().unwrap(); + /// ``` + pub fn http1_title_case_headers(self) -> ClientBuilder { + self.with_inner(|inner| inner.http1_title_case_headers()) + } + /// Bind to a local IP Address /// /// # Example