Closed mharj closed 11 months ago
@mharj thanks for reporting. cross-fetch is just a proxy lib that decides which implementation to use based on the environment it's running on. If it's Node.js, it will delegate to node-fetch. If it's in a browser, whatwg-fetch is the chosen lib. Please reach out to one of these repos to report implementation issues.
According fetch documentation and also quickly tested how browser works, I think res.json() => should throw SyntaxError if payload is not valid JSON one .. currently I'm getting FetchError instance instead on unit testing.
Example from Browser console (when in https://www.google.com)