-
Notifications
You must be signed in to change notification settings - Fork 195
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
Issue 75: Fetch cannot be mocked #77
Conversation
…stered fetch function.
Thanks for creating the PR. Hope this gets merged soon. |
Not a fan: depending on globals is an anti-pattern |
By definition the Fetch API provides a global function.
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch |
I wonder whether requiring a fetch polyfill at all should be left to the user - for instance I'm already using whatwg-fetch as I haven't yet implemented server-side rendering. Either way my app may only require supporting modern browsers in which case this just adds to the download weight. In which case isomorphic-fetch should be moved to devDependencies as it's then only required for testing. |
Definitely, it should be up to the user to supply their favourite fetch polyfill. A library should be indifferent to whether that happens to be An option to avoid globals would be to allow the user to supply a fetch implementation when creating the middleware. |
@alexanderchr see #58 |
I much prefer #58 (so I'm closing this — thanks though, @farmisen). I probably won't merge that one either though because I'm thinking of allowing an object of options at creation time, which would allow not only a custom |
Hey @agraboso, how far away are we from having an object of options at creation time? |
What is the status of the repo? It seems to be pretty stagnant now. |
Came here to report it and saw @cevou did it a few days ago (#75). So here is a very simple PR to fix this problem.
Stop importing fetch from isomorphic-fect to rely on the globally registered fetch function.