summaryrefslogtreecommitdiff
path: root/ext/fetch/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-09 08:10:54 -0400
committerGitHub <noreply@github.com>2023-03-09 12:10:54 +0000
commitc3cba7f22c49ca3a3f58df44d8ea4c85d8510bff (patch)
treec710275a5c51b8a4c8175a3ebe92c928272bf3dc /ext/fetch/lib.rs
parent521cb4ca9b9b02f7ba3150338d5f3c4b035aab8d (diff)
refactor(core): Extension::builder_with_deps (#18093)
Prerequisite for https://github.com/denoland/deno/pull/18080
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r--ext/fetch/lib.rs64
1 files changed, 33 insertions, 31 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index f2a962539..8576b3c53 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -95,37 +95,39 @@ pub fn init<FP>(options: Options) -> Extension
where
FP: FetchPermissions + 'static,
{
- Extension::builder(env!("CARGO_PKG_NAME"))
- .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_console"])
- .esm(include_js_files!(
- "20_headers.js",
- "21_formdata.js",
- "22_body.js",
- "22_http_client.js",
- "23_request.js",
- "23_response.js",
- "26_fetch.js",
- ))
- .ops(vec![
- op_fetch::decl::<FP>(),
- op_fetch_send::decl(),
- op_fetch_custom_client::decl::<FP>(),
- ])
- .state(move |state| {
- state.put::<Options>(options.clone());
- state.put::<reqwest::Client>({
- create_http_client(
- options.user_agent.clone(),
- options.root_cert_store.clone(),
- vec![],
- options.proxy.clone(),
- options.unsafely_ignore_certificate_errors.clone(),
- options.client_cert_chain_and_key.clone(),
- )
- .unwrap()
- });
- })
- .build()
+ Extension::builder_with_deps(
+ env!("CARGO_PKG_NAME"),
+ &["deno_webidl", "deno_web", "deno_url", "deno_console"],
+ )
+ .esm(include_js_files!(
+ "20_headers.js",
+ "21_formdata.js",
+ "22_body.js",
+ "22_http_client.js",
+ "23_request.js",
+ "23_response.js",
+ "26_fetch.js",
+ ))
+ .ops(vec![
+ op_fetch::decl::<FP>(),
+ op_fetch_send::decl(),
+ op_fetch_custom_client::decl::<FP>(),
+ ])
+ .state(move |state| {
+ state.put::<Options>(options.clone());
+ state.put::<reqwest::Client>({
+ create_http_client(
+ options.user_agent.clone(),
+ options.root_cert_store.clone(),
+ vec![],
+ options.proxy.clone(),
+ options.unsafely_ignore_certificate_errors.clone(),
+ options.client_cert_chain_and_key.clone(),
+ )
+ .unwrap()
+ });
+ })
+ .build()
}
pub type CancelableResponseFuture =