Bugfix
parent
b0241e51a3
commit
2f99d0de59
|
@ -105,7 +105,7 @@ pub struct ClientConfig {
|
||||||
user_agent: Option<HeaderValue>,
|
user_agent: Option<HeaderValue>,
|
||||||
disable_ssl_verification: bool,
|
disable_ssl_verification: bool,
|
||||||
base_config: BaseClientConfig,
|
base_config: BaseClientConfig,
|
||||||
timeout: Duration,
|
timeout: Option<Duration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg_attr(tarpaulin, skip)]
|
// #[cfg_attr(tarpaulin, skip)]
|
||||||
|
@ -202,7 +202,7 @@ impl ClientConfig {
|
||||||
|
|
||||||
/// Set a timeout duration for all HTTP requests. The default is no timeout.
|
/// Set a timeout duration for all HTTP requests. The default is no timeout.
|
||||||
pub fn timeout(mut self, timeout: Duration) -> Self {
|
pub fn timeout(mut self, timeout: Duration) -> Self {
|
||||||
self.timeout = timeout;
|
self.timeout = Some(timeout);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,12 @@ impl Client {
|
||||||
Err(_e) => panic!("Error parsing homeserver url"),
|
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"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
let http_client = {
|
let http_client = {
|
||||||
|
|
Loading…
Reference in New Issue