Skip to content

Commit c7e966c

Browse files
authored
Remove HeaderExt and AbortSignalExt (#621)
* Remove HeaderExt Closes #617 * Fix deprecation warnings * feature
1 parent 6a5bfc1 commit c7e966c

File tree

16 files changed

+204
-251
lines changed

16 files changed

+204
-251
lines changed

Cargo.lock

Lines changed: 161 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/digest/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ async fn main(_req: Request, _env: Env, _ctx: Context) -> Result<Response> {
2929
}
3030

3131
fn str_to_readable_stream(value: &str) -> web_sys::ReadableStream {
32-
let mut req_init = web_sys::RequestInit::new();
33-
req_init.method("POST");
34-
req_init.body(Some(&JsValue::from_str(value)));
32+
let req_init = web_sys::RequestInit::new();
33+
req_init.set_method("POST");
34+
req_init.set_body(&JsValue::from_str(value));
3535
let req = web_sys::Request::new_with_str_and_init("http://internal", &req_init).unwrap();
3636
req.body().unwrap()
3737
}

worker-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ wasm-bindgen.workspace = true
1313
cfg-if = "1.0.0"
1414

1515
[dependencies.web-sys]
16-
version = "0.3.63"
16+
version = ">=0.3.70"
1717
features = [
1818
"ReadableStream",
1919
"WritableStream",

worker-sys/src/ext.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
mod abort_controller;
2-
mod abort_signal;
32
mod cache_storage;
4-
mod headers;
53
mod request;
64
mod response;
75
mod response_init;
86
mod websocket;
97

108
pub use abort_controller::*;
11-
pub use abort_signal::*;
129
pub use cache_storage::*;
13-
pub use headers::*;
1410
pub use request::*;
1511
pub use response::*;
1612
pub use response_init::*;

worker-sys/src/ext/abort_signal.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

worker-sys/src/ext/headers.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

worker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ version = "0.8.4"
4545
default-features = false
4646

4747
[dependencies.web-sys]
48-
version = "0.3.63"
48+
version = ">=0.3.70"
4949
features = [
5050
"File",
5151
"WorkerGlobalScope",

worker/src/abort.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::ops::Deref;
22

33
use wasm_bindgen::JsValue;
4-
use worker_sys::ext::{AbortControllerExt, AbortSignalExt};
54

65
/// An interface that allows you to abort in-flight [Fetch](crate::Fetch) requests.
76
#[derive(Debug)]

worker/src/cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ impl Cache {
103103
key: K,
104104
ignore_method: bool,
105105
) -> Result<Option<Response>> {
106-
let mut options = web_sys::CacheQueryOptions::new();
107-
options.ignore_method(ignore_method);
106+
let options = web_sys::CacheQueryOptions::new();
107+
options.set_ignore_method(ignore_method);
108108

109109
let promise = match key.into() {
110110
CacheKey::Url(url) => self
@@ -136,8 +136,8 @@ impl Cache {
136136
key: K,
137137
ignore_method: bool,
138138
) -> Result<CacheDeletionOutcome> {
139-
let mut options = web_sys::CacheQueryOptions::new();
140-
options.ignore_method(ignore_method);
139+
let options = web_sys::CacheQueryOptions::new();
140+
options.set_ignore_method(ignore_method);
141141

142142
let promise = match key.into() {
143143
CacheKey::Url(url) => self

worker/src/global.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ impl Fetch {
3131
}
3232

3333
async fn fetch_with_str(url: &str, signal: Option<&AbortSignal>) -> Result<Response> {
34-
let mut init = web_sys::RequestInit::new();
35-
init.signal(signal.map(|x| x.deref()));
34+
let init = web_sys::RequestInit::new();
35+
init.set_signal(signal.map(|x| x.deref()));
3636

3737
let worker: web_sys::WorkerGlobalScope = js_sys::global().unchecked_into();
3838
let promise = worker.fetch_with_str_and_init(url, &init);
@@ -42,8 +42,8 @@ async fn fetch_with_str(url: &str, signal: Option<&AbortSignal>) -> Result<Respo
4242
}
4343

4444
async fn fetch_with_request(request: &Request, signal: Option<&AbortSignal>) -> Result<Response> {
45-
let mut init = web_sys::RequestInit::new();
46-
init.signal(signal.map(|x| x.deref()));
45+
let init = web_sys::RequestInit::new();
46+
init.set_signal(signal.map(|x| x.deref()));
4747

4848
let worker: web_sys::WorkerGlobalScope = js_sys::global().unchecked_into();
4949
let req = request.inner();

0 commit comments

Comments
 (0)