From 5ba9d9b2c23cb403dd2125c72fa08e9a0a12c1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 3 Mar 2023 12:39:22 +0100 Subject: [PATCH] http: sync: remove redundant calls for setting User-Agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the requests are all created via the agent that already contains the user agent, so this internal helper isn't needed anymore. Signed-off-by: Fabian Grünbichler --- proxmox-http/src/client/sync.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/proxmox-http/src/client/sync.rs b/proxmox-http/src/client/sync.rs index 9465d8e1..228f839c 100644 --- a/proxmox-http/src/client/sync.rs +++ b/proxmox-http/src/client/sync.rs @@ -37,19 +37,7 @@ impl Client { Ok(builder.build()) } - fn add_user_agent(&self, req: ureq::Request) -> ureq::Request { - req.set( - "User-Agent", - self.options - .user_agent - .as_deref() - .unwrap_or(DEFAULT_USER_AGENT_STRING), - ) - } - fn call(&self, req: ureq::Request) -> Result { - let req = self.add_user_agent(req); - req.call().map_err(Into::into) } @@ -57,8 +45,6 @@ impl Client { where R: Read, { - let req = self.add_user_agent(req); - req.send(body).map_err(Into::into) } @@ -147,7 +133,6 @@ impl HttpClient for Client { let mut req = self .agent()? .request(request.method().as_str(), &request.uri().to_string()); - req = self.add_user_agent(req); let orig_headers = request.headers(); @@ -195,7 +180,6 @@ impl HttpClient<&[u8], Vec> for Client { let mut req = self .agent()? .request(request.method().as_str(), &request.uri().to_string()); - req = self.add_user_agent(req); let orig_headers = request.headers();