Maybe I am overlooking things, but i want to make ...
# ktor
a
Maybe I am overlooking things, but i want to make a simple request using the Ktor Client in JS to https://xkcd.com/info.0.json However, the xkcd server doesn't have CORS enabled and as such Chrome is blocking it. But I can't find how to set
mode
to
no-cors
for Ktor Client in JS.
a
So are you making a request from a browser environment?
a
Yes, to a server I don't control
a
Then you can’t do a cross origin request.
a
But you can, when using the browser fetch API and setting mode to no-cors.
But not using Ktor Client
However, I decided to make my life easier and found a CORS enabled version of the API: https://github.com/mrmartineau/xkcd-api
And voila, it works