From 816e47c25964284de9f9f91bb9e1afd1a5e75a06 Mon Sep 17 00:00:00 2001 From: aaravm Date: Thu, 11 Jul 2024 14:58:13 +0530 Subject: [PATCH] sorcery ai suggestion --- lib/src/transport.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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() {