Open
Description
In my sample application with Kotlin/Wasm 2.1.21 , window.fetch(url)
works as expected, but window.fetch(url, RequestInit(method = "POST"))
throws the following error:
sample-wasm-js.uninstantiated.mjs:150 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'cache' property from 'RequestInit': The provided value 'null' is not a valid enum value of type RequestCache.
at org.w3c.dom.fetch_$external_fun (sample-wasm-js.uninstantiated.mjs:150:82)
at 04d61904f8aaba159022.wasm:0x35d09
at 04d61904f8aaba159022.wasm:0x34d5c
at HTMLFormElement.<anonymous> (sample-wasm-js.uninstantiated.mjs:142:127)
If I change to window.fetch(url, RequestInit(method = "POST", cache = RequestCache.Companion.DEFAULT))
, I get:
sample-wasm-js.uninstantiated.mjs:150 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'credentials' property from 'RequestInit': The provided value 'null' is not a valid enum value of type RequestCredentials.
at org.w3c.dom.fetch_$external_fun (sample-wasm-js.uninstantiated.mjs:150:82)
at ba229722ec51e8dd8a68.wasm:0x35d74
at ba229722ec51e8dd8a68.wasm:0x34d9d
at HTMLFormElement.<anonymous> (sample-wasm-js.uninstantiated.mjs:142:127)
org.w3c.dom.fetch_$external_fun @ sample-wasm-js.uninstantiated.mjs:150
$func1542 @ ba229722ec51e8dd8a68.wasm:0x35d74
$__callFunction___Js_->Unit_ @ ba229722ec51e8dd8a68.wasm:0x34d9d
(anonymous) @ sample-wasm-js.uninstantiated.mjs:142
If I change to window.fetch(url, RequestInit(method = "POST", cache = RequestInit(method = "POST", cache = RequestCache.Companion.DEFAULT, credentials = RequestCredentials.Companion.OMIT))
, I get:
sample-wasm-js.uninstantiated.mjs:150 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': The provided value is not of type '(record<ByteString, ByteString> or sequence<sequence<ByteString>>)'.
at org.w3c.dom.fetch_$external_fun (sample-wasm-js.uninstantiated.mjs:150:82)
at 99192d8e1d750b4a96d2.wasm:0x35de7
at 99192d8e1d750b4a96d2.wasm:0x34dfc
at HTMLFormElement.<anonymous> (sample-wasm-js.uninstantiated.mjs:142:127)
org.w3c.dom.fetch_$external_fun @ sample-wasm-js.uninstantiated.mjs:150
$func1544 @ 99192d8e1d750b4a96d2.wasm:0x35de7
$__callFunction___Js_->Unit_ @ 99192d8e1d750b4a96d2.wasm:0x34dfc
(anonymous) @ sample-wasm-js.uninstantiated.mjs:142
Please allows to specify RequestInit
with just some properties defined.
Metadata
Metadata
Assignees
Labels
No labels