-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the polyfill fetch
library being used always?
#361
Comments
Is this happening for you in Node? |
I haven't tried it in Node. I realize now I wasn't very descriptive of my scenario. I'm building a React project w/ React Router and using Mirage JS as a fake API. Mirage JS is using Pretender, which is using There are some limitations to the polyfill and streaming responses, which is why they chose not to include a true I wrote this little PR that would check to see if the browser being used has I also might be way in over my head with this 😅 but I thought I'd give it a shot in the dark to see if that might help avoid using the polyfill if it isn't needed in that environment. But I'm very happy to be corrected if I'm not going about things the right way. |
The exact same issue is happening on Next.js with its app router. Next's app router uses the |
There's a conflict with React Router ≥ v6.4.5, where it always expects a response to have a
body
property. However, thewhatwg-fetch
library used by pretender is intercepting theResponse
created by React Router and appending a_bodyInit
property instead of abody
property. So React Router checks this Response with a duck-typing check, sees that it doesn't have abody
property (which the W3 spec requires of a Response obj), and rejects it as not being a valid Response.(In v6.4.4 they were checking it with
instanceof Request
which was passing that check.)My question is, why is this polyfilled
fetch
being used instead of the native fetch when my browser has a native fetch? The native fetch doesn't have this problem.The text was updated successfully, but these errors were encountered: