Add http1_title_case_headers option to ClientBuilder (#463)
This commit is contained in:
committed by
Sean McArthur
parent
4fba983e5e
commit
aa8348ba1e
@@ -78,6 +78,7 @@ struct Config {
|
|||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
tls: TlsBackend,
|
tls: TlsBackend,
|
||||||
http2_only: bool,
|
http2_only: bool,
|
||||||
|
http1_title_case_headers: bool,
|
||||||
local_address: Option<IpAddr>,
|
local_address: Option<IpAddr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ impl ClientBuilder {
|
|||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
tls: TlsBackend::default(),
|
tls: TlsBackend::default(),
|
||||||
http2_only: false,
|
http2_only: false,
|
||||||
|
http1_title_case_headers: false,
|
||||||
local_address: None,
|
local_address: None,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -186,6 +188,10 @@ impl ClientBuilder {
|
|||||||
builder.http2_only(true);
|
builder.http2_only(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.http1_title_case_headers {
|
||||||
|
builder.http1_title_case_headers(true);
|
||||||
|
}
|
||||||
|
|
||||||
let hyper_client = builder.build(connector);
|
let hyper_client = builder.build(connector);
|
||||||
|
|
||||||
let proxies_maybe_http_auth = proxies
|
let proxies_maybe_http_auth = proxies
|
||||||
@@ -329,6 +335,12 @@ impl ClientBuilder {
|
|||||||
self
|
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`.
|
/// Set a timeout for only the connect phase of a `Client`.
|
||||||
///
|
///
|
||||||
/// Default is `None`.
|
/// Default is `None`.
|
||||||
|
|||||||
@@ -324,6 +324,19 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.h2_prior_knowledge())
|
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
|
/// Bind to a local IP Address
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
|||||||
Reference in New Issue
Block a user