Closed FokkeZB closed 3 years ago
hey @FokkeZB ! Thanks for reporting that. cross-fetch
is just a proxy for node-fetch
on node environment and whatwg-fetch
on browsers. The issue you're referring to is on the whatwg-fetch
side. Please double check if this also happens on https://github.com/github/fetch/.
Hey @lquixada - this is indeed happening there as well:
Sandbox: https://codesandbox.io/s/determined-cdn-7k3gx?file=/src/index.js Live: https://7k3gx.csb.app/
Hopefully they will handle this issue! Closing this one.
Hope so! Reported at https://github.com/github/fetch/issues/860
When
options.headers
already is a nativeHeaders
object, this will lead to an emptythis.headers
:https://github.com/lquixada/cross-fetch/blob/22578271d864d24074c455b8a473b46898542f0f/dist/browser-ponyfill.js#L346-L348
This is because the
instanceof
check here is done against the polyfil:https://github.com/lquixada/cross-fetch/blob/22578271d864d24074c455b8a473b46898542f0f/dist/browser-ponyfill.js#L93-L96
We should either not override
Headers
if it already exists, or keep a reference to the original and include it in theinstanceof
check as well.