this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Clear WASM warnings: migrate RequestInit setters, drop dead structs

The WASM build was emitting 7 warnings:

- Five deprecation warnings on `web_sys::RequestInit::{method,
headers, body}`. web-sys moved to setter-style API
(`set_method`, `set_headers`, `set_body`) in a recent release.
Migrated `wasm_transport.rs` accordingly; the new API takes `&self`
so `let mut opts = RequestInit::new()` becomes `let opts = ...`.
- Two dead-code warnings on `EmptyResult` and `UriResult` DTOs in
`wasm_util.rs`. Neither has any callers after the last few rounds
of WASM surface cleanup — deleted.

Post-change the WASM build is warning-clean:
cargo build -p opake-wasm --target wasm32-unknown-unknown
→ Finished, 0 warnings

+6 -16
+6 -6
crates/opake-core/src/client/wasm_transport.rs
··· 28 28 HttpMethod::Post => "POST", 29 29 }; 30 30 log::trace!("[WasmTransport] {} {}", method_str, &request.url); 31 - let mut opts = RequestInit::new(); 32 - opts.method(match request.method { 31 + let opts = RequestInit::new(); 32 + opts.set_method(match request.method { 33 33 HttpMethod::Get => "GET", 34 34 HttpMethod::Post => "POST", 35 35 }); ··· 42 42 } 43 43 headers.set(key, value).map_err(js_err)?; 44 44 } 45 - opts.headers(&headers); 45 + opts.set_headers(&headers); 46 46 47 47 if let Some(body) = request.body { 48 48 match body { ··· 51 51 headers 52 52 .set("Content-Type", "application/json") 53 53 .map_err(js_err)?; 54 - opts.body(Some(&wasm_bindgen::JsValue::from_str(&serialized))); 54 + opts.set_body(&wasm_bindgen::JsValue::from_str(&serialized)); 55 55 } 56 56 RequestBody::Bytes { data, content_type } => { 57 57 headers.set("Content-Type", &content_type).map_err(js_err)?; 58 58 let array = js_sys::Uint8Array::from(data.as_slice()); 59 - opts.body(Some(&array)); 59 + opts.set_body(&array); 60 60 } 61 61 RequestBody::Form(ref params) => { 62 62 let encoded = RequestBody::encode_form(params); 63 63 headers 64 64 .set("Content-Type", "application/x-www-form-urlencoded") 65 65 .map_err(js_err)?; 66 - opts.body(Some(&wasm_bindgen::JsValue::from_str(&encoded))); 66 + opts.set_body(&wasm_bindgen::JsValue::from_str(&encoded)); 67 67 } 68 68 } 69 69 }
-10
crates/opake-wasm/src/wasm_util.rs
··· 72 72 opake.cabinet_context().map_err(wasm_err) 73 73 } 74 74 75 - /// Empty result for operations that return only the updated session. 76 - #[derive(Serialize)] 77 - pub struct EmptyResult {} 78 - 79 - /// Result containing a single AT-URI (used by upload, grant create, leave, etc.). 80 - #[derive(Serialize)] 81 - pub struct UriResult { 82 - pub uri: String, 83 - } 84 - 85 75 /// Result containing a decrypted document (filename + plaintext bytes). 86 76 #[derive(Serialize)] 87 77 pub struct DownloadResult {