master
Stephen 2020-07-16 20:06:26 -03:00
parent b0241e51a3
commit 2f99d0de59
1 changed files with 8 additions and 3 deletions

View File

@ -105,7 +105,7 @@ pub struct ClientConfig {
user_agent: Option<HeaderValue>,
disable_ssl_verification: bool,
base_config: BaseClientConfig,
timeout: Duration,
timeout: Option<Duration>,
}
// #[cfg_attr(tarpaulin, skip)]
@ -202,7 +202,7 @@ impl ClientConfig {
/// Set a timeout duration for all HTTP requests. The default is no timeout.
pub fn timeout(mut self, timeout: Duration) -> Self {
self.timeout = timeout;
self.timeout = Some(timeout);
self
}
}
@ -305,7 +305,12 @@ impl Client {
Err(_e) => panic!("Error parsing homeserver url"),
};
let http_client = reqwest::Client::builder().timeout(config.timeout);
let http_client = reqwest::Client::builder();
let http_client = match (config.timeout) {
Some(x) => http_client.timeout(x),
None => http_client,
};
#[cfg(not(target_arch = "wasm32"))]
let http_client = {