Add multipart for WASM (#966)

This commit is contained in:
Enno Boland
2020-07-08 22:10:23 +02:00
committed by GitHub
parent af9fc5c9d8
commit a800202384
7 changed files with 335 additions and 13 deletions

View File

@@ -1,5 +1,4 @@
use http::Method;
use js_sys::Uint8Array;
use std::future::Future;
use wasm_bindgen::UnwrapThrowExt as _;
use url::Url;
@@ -133,9 +132,7 @@ async fn fetch(req: Request) -> crate::Result<Response> {
}
if let Some(body) = req.body() {
let body_bytes: &[u8] = body.bytes();
let body_array: Uint8Array = body_bytes.into();
init.body(Some(&body_array.into()));
init.body(Some(&body.to_js_value()?.as_ref().as_ref()));
}
let js_req = web_sys::Request::new_with_str_and_init(req.url().as_str(), &init)