Add RequestBuilder::fetch_mode_no_cors()

This commit is contained in:
rhysd
2020-01-06 12:54:24 +09:00
committed by Sean McArthur
parent 22fe6566ff
commit 6004623784
4 changed files with 37 additions and 0 deletions

View File

@@ -120,6 +120,11 @@ async fn fetch(req: Request) -> crate::Result<Response> {
}
init.headers(&js_headers.into());
// When req.cors is true, do nothing because the default mode is 'cors'
if !req.cors {
init.mode(web_sys::RequestMode::NoCors);
}
if let Some(body) = req.body() {
let body_bytes: &[u8] = body.bytes();
let body_array: Uint8Array = body_bytes.into();