diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index f811abd9..16e4325c 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -105,7 +105,7 @@ pub struct ClientConfig { user_agent: Option, disable_ssl_verification: bool, base_config: BaseClientConfig, - timeout: Duration, + timeout: Option, } // #[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 = {