diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-28 12:14:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 12:14:11 +0200 |
commit | 45d4fd44c9444241a898d3075b99e8871fccdd65 (patch) | |
tree | c6ac6bb880023326e935f96d56ef23ba891f92d3 /cli/ops/fetch.rs | |
parent | 8ceb165e5d1dc0c8d417e42ffc3a26e8f5a62a03 (diff) |
refactor: move op state registration to workers (#7696)
Diffstat (limited to 'cli/ops/fetch.rs')
-rw-r--r-- | cli/ops/fetch.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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::<reqwest::Client>({ + crate::http_util::create_http_client(maybe_ca_file).unwrap() + }); + } super::reg_json_async(rt, "op_fetch", deno_fetch::op_fetch::<Permissions>); super::reg_json_async(rt, "op_fetch_read", deno_fetch::op_fetch_read); super::reg_json_sync( |