summaryrefslogtreecommitdiff
path: root/ext/fetch/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-23 23:27:58 +0100
committerGitHub <noreply@github.com>2023-03-23 23:27:58 +0100
commit275dee60e71225a9c6c4b3b4ea7ffe4c6ecb4d87 (patch)
tree13ed3ab7e825a81085e8dcc5efeee417416b86cf /ext/fetch/lib.rs
parentedab8f2fd48efddc19eb0032955fee4b5dbf76e6 (diff)
refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r--ext/fetch/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index 9ed73161d..17f30d8ed 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -114,7 +114,7 @@ deno_core::extension!(deno_fetch,
state.put::<Options>(options.options.clone());
state.put::<reqwest::Client>({
create_http_client(
- options.options.user_agent,
+ &options.options.user_agent,
options.options.root_cert_store,
vec![],
options.options.proxy,
@@ -631,7 +631,7 @@ where
.collect::<Vec<_>>();
let client = create_http_client(
- options.user_agent.clone(),
+ &options.user_agent,
options.root_cert_store.clone(),
ca_certs,
args.proxy,
@@ -646,7 +646,7 @@ where
/// Create new instance of async reqwest::Client. This client supports
/// proxies and doesn't follow redirects.
pub fn create_http_client(
- user_agent: String,
+ user_agent: &str,
root_cert_store: Option<RootCertStore>,
ca_certs: Vec<Vec<u8>>,
proxy: Option<Proxy>,