diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-03-18 23:54:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 23:54:26 +0100 |
commit | 7d12dd18992cc58ce9866c2e42d914c8c8cf6d7a (patch) | |
tree | d4cc0871a744b72b9a4f7b7c8e926741d9108a90 /runtime/ops/fetch.rs | |
parent | fb5a2786ec9854ceca840daeb9ae154dcf804d12 (diff) |
fix: fallback to default UA and CA data for Deno.createHttpClient() (#9830)
Diffstat (limited to 'runtime/ops/fetch.rs')
-rw-r--r-- | runtime/ops/fetch.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/ops/fetch.rs b/runtime/ops/fetch.rs index e1b43c910..9ab86858d 100644 --- a/runtime/ops/fetch.rs +++ b/runtime/ops/fetch.rs @@ -1,7 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use crate::http_util; use crate::permissions::Permissions; use deno_fetch::reqwest; +use deno_fetch::HttpClientDefaults; pub fn init( rt: &mut deno_core::JsRuntime, @@ -12,7 +12,12 @@ pub fn init( let op_state = rt.op_state(); let mut state = op_state.borrow_mut(); state.put::<reqwest::Client>({ - http_util::create_http_client(user_agent, ca_data).unwrap() + deno_fetch::create_http_client(user_agent.clone(), ca_data.clone()) + .unwrap() + }); + state.put::<HttpClientDefaults>(HttpClientDefaults { + ca_data, + user_agent, }); } super::reg_json_sync(rt, "op_fetch", deno_fetch::op_fetch::<Permissions>); |