And XMLHttpRequest sends a POST to `/#/newlog` ins...
# javascript
r
And XMLHttpRequest sends a POST to
/#/newlog
instead of
/newlog
k
Did you try to pass
url
to XHR.open?
r
Copy code
suspend fun httpPost(url: String, body: dynamic): String = suspendCoroutine { c ->
    val req = XMLHttpRequest()
    req.onreadystatechange = {
        if(req.readyState == XMLHttpRequest.DONE) {
            if(req.status / 100 == 2) {
                c.resume(req.response as String)
            }else {
                c.resumeWithException(RuntimeException("HTTP error: ${req.status}"))
            }
        }
        null
    }

    req.open("POST", url)
    req.send(body)
}
That's the code I'm working with
k
What do you pass as an URL to
httpPost
function?
r
/newlog