AsyncClient: The use_sys_proxy setting is deprecated upstream.

This commit is contained in:
Damir Jelić 2019-11-17 19:56:53 +01:00
parent 88bfe1bec6
commit d281efb309

View file

@ -52,7 +52,6 @@ pub struct AsyncClient {
#[derive(Default, Debug)]
pub struct AsyncClientConfig {
proxy: Option<reqwest::Proxy>,
use_sys_proxy: bool,
user_agent: Option<HeaderValue>,
disable_ssl_verification: bool,
}
@ -63,25 +62,10 @@ impl AsyncClientConfig {
}
pub fn proxy(mut self, proxy: &str) -> Result<Self, Error> {
if self.use_sys_proxy {
return Err(Error(InnerError::ConfigurationError(
"Using the system proxy has been previously configured.".to_string(),
)));
}
self.proxy = Some(reqwest::Proxy::all(proxy)?);
Ok(self)
}
pub fn use_sys_proxy(mut self) -> Result<Self, Error> {
if self.proxy.is_some() {
return Err(Error(InnerError::ConfigurationError(
"A proxy has already been configured.".to_string(),
)));
}
self.use_sys_proxy = true;
Ok(self)
}
pub fn disable_ssl_verification(mut self) -> Self {
self.disable_ssl_verification = true;
self
@ -162,12 +146,6 @@ impl AsyncClient {
None => http_client,
};
let http_client = if config.use_sys_proxy {
http_client.use_sys_proxy()
} else {
http_client
};
let mut headers = reqwest::header::HeaderMap::new();
let user_agent = match config.user_agent {