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

Fetch cannot be mocked #75

Closed
cevou opened this issue May 7, 2016 · 2 comments
Closed

Fetch cannot be mocked #75

cevou opened this issue May 7, 2016 · 2 comments

Comments

@cevou
Copy link

cevou commented May 7, 2016

Hi,

at the moment requests send through this middleware cannot be mocked (through fetch-mock). This is due to the fact, that fetch is imported from isomorphic-fetch rather then using the global fetch function.
The standard defined the fetch function as global. isomorphic-fetch registers it as a global function in nodejs and in the browser.
It would be great if you could just load the module but not import the fetch function. I could also provide a PR for that.

Best,
Christoph

@migueloller
Copy link

migueloller commented Jun 29, 2016

Not only can fetch not be mocked but this is also causing errors for React Native bundles due to #125 and #5667. It would be best to leave it up to the developer to provide a fetch polyfill. That way, if they have an environment that already implements fetch, this error won't happen.

This doesn't only happen in React Native. It will happen on any environment that already has fetch and requires a package, like redux-api-middleware that also polyfills fetch.

@agraboso
Copy link
Owner

agraboso commented May 1, 2017

The next branch (which will lead to version 2) removes isomorphic-fetch in favor of the global fetch.

@agraboso agraboso closed this as completed May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants