Skip to content

Commit 535e103

Browse files
authored
[worker] Add FormData conversion into JsValue (#634)
This allows FormData to be constructed and passed as JsValue later on. For instance, `RequestInit::new().with_body(Some(formdata.into()))`
1 parent 5100f4e commit 535e103

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

worker/src/formdata.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ impl From<HashMap<&dyn AsRef<&str>, &dyn AsRef<&str>>> for FormData {
128128
}
129129
}
130130

131+
impl From<FormData> for wasm_bindgen::JsValue {
132+
fn from(val: FormData) -> Self {
133+
val.0.into()
134+
}
135+
}
136+
131137
/// A [File](https://developer.mozilla.org/en-US/docs/Web/API/File) representation used with
132138
/// `FormData`.
133139
pub struct File(web_sys::File);

0 commit comments

Comments
 (0)