mmaillot
02/07/2018, 3:50 PMval request = XMLHttpRequest()
request.open("GET", endpoint, false)
request.send(null)
if (request.status.toInt() == 200) {
return JSON.parse(request.responseText)
}
And I get this error : XMLHttpRequest is not defined
. My code run on NodeJS and NodeJS doesn't have XMLHttpRequest...
Should I use another lib and wrap it ?mmaillot
02/07/2018, 3:52 PMbashor
02/07/2018, 7:06 PMTristan Caron
02/07/2018, 7:41 PMrequest-promise-native
and kotlinx.coroutines
if you want to.
If you want to stay close to the standard you can use https://www.npmjs.com/package/node-fetch and you will get something similar to what you can have in your browser.
Or you can just go with the API which has been mentioned before.mmaillot
02/08/2018, 9:12 AMTristan Caron
02/08/2018, 10:04 AM