redrield
11/17/2017, 11:50 AM/#/newlog
instead of /newlog
konsoletyper
11/17/2017, 11:52 AMurl
to XHR.open?redrield
11/17/2017, 12:08 PMsuspend 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)
}
redrield
11/17/2017, 12:08 PMkonsoletyper
11/17/2017, 12:14 PMhttpPost
function?redrield
11/17/2017, 12:45 PM/newlog