When sending a request using window.fetch, if you use ReqeustInit, you will not be able to send the request, even if RequestInit does not write anything.
(Because the picture cannot be uploaded, post the code.)
object ApiUtil {
suspend fun login(username: String, password: String): ResultUDM<JsString> {
val response = window.fetch(
"http://127.0.0.1:9002/user/login", RequestInit(
method = "POST", body = LoginUser(username, password)
)
).await<Response>()
return response.json().await()
}
}
Browser console error:JsException: Exception was thrown while running JavaScript code
If the ReqeustInit parameter is removed, it can run normally.
When sending a request using window.fetch, if you use ReqeustInit, you will not be able to send the request, even if RequestInit does not write anything.
(Because the picture cannot be uploaded, post the code.)
Browser console error:JsException: Exception was thrown while running JavaScript code
If the ReqeustInit parameter is removed, it can run normally.
Version information: