diff --git a/lib/src/transport.rs b/lib/src/transport.rs index 7c13d54..98690e4 100644 --- a/lib/src/transport.rs +++ b/lib/src/transport.rs @@ -32,11 +32,12 @@ impl Transport { Box::new(std::io::Error::new(std::io::ErrorKind::InvalidInput, "Invalid endpoint")) as Box })?; - let mut request_builder = self.client.request(method, url).header( - reqwest::header::USER_AGENT, - self.config.user_agent.clone().unwrap_or_default(), - ); + let mut request_builder = self.client.request(method, url); + if let Some(ref user_agent) = self.config.user_agent { + request_builder = request_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref params_value) = params { // Validate or log params_value before setting it as query parameters if params_value.is_object() {