Skip to content
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

Add polyfill/support for Request #90

Open
studentIvan opened this issue Sep 14, 2018 · 2 comments
Open

Add polyfill/support for Request #90

studentIvan opened this issue Sep 14, 2018 · 2 comments

Comments

@studentIvan
Copy link

If I use Request, I also can set headers, method, etc and work with it.
https://developer.mozilla.org/en-US/docs/Web/API/Request

@developit
Copy link
Owner

I was originally against this since it's impossible to do in 500b, but I think we need a solution. Perhaps shipping the JS Modules build with { fetch, Request, Response, Headers, AbortController } as exports would promote correct usage.

@Gelio
Copy link

Gelio commented Jan 21, 2022

My use case was trying to use isomorphic-unfetch in jest tests running in Node. Since fetch was not globally set, isomorphic-unfetch used the one from node-fetch and fetching was working fine. The problem appeared I hit new Request(...) in my tests. Request was not globally available in Node, which threw an error.

I ended up polyfilling those globally-available fetch-related symbols using the method suggested in https://github.com/node-fetch/node-fetch#providing-global-access in my jest-setup.js.

I'm sharing just in case someone is also looking for a solution how to get those globals to work in jest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants