mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
This commit is contained in:
parent
edab8f2fd4
commit
275dee60e7
14 changed files with 91 additions and 79 deletions
|
@ -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>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue