Kotlin Js issue with fetch api


#1

I’m converting some plain js code to koltin-js and I’m having issues with the fetch api with even basic requests like this:

window.fetch(url,
        init = RequestInit(credentials = RequestCredentials.SAME_ORIGIN))

this generates the error:

Uncaught (in promise) TypeError: Failed to execute ‘fetch’ on ‘Window’: The provided value ‘null’ is not a valid enum value of type RequestCache.

I can get it to work but I have to add a few extra things like “cache = undefined” and “redirect = undefined”

Also when I do add these and get it to work I keep getting warnings in the console like this:

Error parsing ‘integrity’ attribute (‘null’). The hash algorithm must be one of ‘sha256’, ‘sha384’, or ‘sha512’, followed by a ‘-’ character.

The pure javascript solution doesn’t have any of these issues.

I’m using kotlin-js 1.2.71


#2

Same issue, it’s rather annoying that even sending a simple POST request somewhere is quite the challenging task in KotlinJS if someone is not familiar with Javascript.