Closed dhowe closed 11 months ago
Thanks but I'm afraid we cannot use it in the browser. It's by mocking browser request with Node, however, the browser doesn't allow us to add some unsafe headers for the security. We have to run it in a server.
What is the header that is not allowed in the browser (just curious)?
The referer
header and user-agent
header etc. We can't change it at will in the browser.
Would not replacing got
with something like ky-universal, support both node and the browser?
Actually, the referer doesn't matter, cookies don't matter, and the browser's own User Agent is fine. A few tweaks this can totally work inside a browser - but you do have to use a CORS anywhere proxy to get around the SOP. I have it working locally, I'll send a PR soon. You don't even need ky
, plain browser fetch
is sufficient.
Thanks for the nice library - I'm wondering if there is a way to use it in the browser? I've tried browserify, but
got
seems not to be compatible. Any suggestions?