summaryrefslogtreecommitdiff
path: root/op_crates/fetch
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-04-29 00:16:45 +0200
committerGitHub <noreply@github.com>2021-04-28 18:16:45 -0400
commite89295b176b4f494d19b547b6b4d7c98d0cf1da1 (patch)
treeae2f043d8a883b6f6f754c057b8dfe678b3c7944 /op_crates/fetch
parente63c53315450ed305752566f4c3ad2bb76c8b8a3 (diff)
refactor(extensions): reintroduce builder (#10412)
Diffstat (limited to 'op_crates/fetch')
-rw-r--r--op_crates/fetch/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/op_crates/fetch/lib.rs b/op_crates/fetch/lib.rs
index 7033a416c..861fc6e54 100644
--- a/op_crates/fetch/lib.rs
+++ b/op_crates/fetch/lib.rs
@@ -56,8 +56,8 @@ pub fn init<P: FetchPermissions + 'static>(
user_agent: String,
ca_data: Option<Vec<u8>>,
) -> Extension {
- Extension::with_ops(
- include_js_files!(
+ Extension::builder()
+ .js(include_js_files!(
prefix "deno:op_crates/fetch",
"01_fetch_util.js",
"11_streams.js",
@@ -68,15 +68,15 @@ pub fn init<P: FetchPermissions + 'static>(
"23_request.js",
"23_response.js",
"26_fetch.js",
- ),
- vec![
+ ))
+ .ops(vec![
("op_fetch", op_sync(op_fetch::<P>)),
("op_fetch_send", op_async(op_fetch_send)),
("op_fetch_request_write", op_async(op_fetch_request_write)),
("op_fetch_response_read", op_async(op_fetch_response_read)),
("op_create_http_client", op_sync(op_create_http_client::<P>)),
- ],
- Some(Box::new(move |state| {
+ ])
+ .state(move |state| {
state.put::<reqwest::Client>({
create_http_client(user_agent.clone(), ca_data.clone()).unwrap()
});
@@ -85,8 +85,8 @@ pub fn init<P: FetchPermissions + 'static>(
user_agent: user_agent.clone(),
});
Ok(())
- })),
- )
+ })
+ .build()
}
pub struct HttpClientDefaults {