From 7d12dd18992cc58ce9866c2e42d914c8c8cf6d7a Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Thu, 18 Mar 2021 23:54:26 +0100 Subject: fix: fallback to default UA and CA data for Deno.createHttpClient() (#9830) --- runtime/ops/fetch.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'runtime/ops') 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::({ - 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 { + ca_data, + user_agent, }); } super::reg_json_sync(rt, "op_fetch", deno_fetch::op_fetch::); -- cgit v1.2.3