From 45d4fd44c9444241a898d3075b99e8871fccdd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 28 Sep 2020 12:14:11 +0200 Subject: refactor: move op state registration to workers (#7696) --- cli/ops/fetch.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cli/ops/fetch.rs') diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs index 54585dc3d..8c1a2b39c 100644 --- a/cli/ops/fetch.rs +++ b/cli/ops/fetch.rs @@ -1,7 +1,15 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::permissions::Permissions; +use deno_fetch::reqwest; -pub fn init(rt: &mut deno_core::JsRuntime) { +pub fn init(rt: &mut deno_core::JsRuntime, maybe_ca_file: Option<&str>) { + { + let op_state = rt.op_state(); + let mut state = op_state.borrow_mut(); + state.put::({ + crate::http_util::create_http_client(maybe_ca_file).unwrap() + }); + } super::reg_json_async(rt, "op_fetch", deno_fetch::op_fetch::); super::reg_json_async(rt, "op_fetch_read", deno_fetch::op_fetch_read); super::reg_json_sync( -- cgit v1.2.3