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

Ability to provide custom fetch #56

Closed
prichodko opened this issue Oct 22, 2018 · 3 comments
Closed

Ability to provide custom fetch #56

prichodko opened this issue Oct 22, 2018 · 3 comments

Comments

@prichodko
Copy link

I am loving the simplicity of this module. What I also love is Next.js. However, those two unfortunately doesn't play well with each other.

Trying to call ky inside Next's getInitialProps throws that self is not defined, because during first request Next.js calls getInitialProps on the server.

One possible solution would be to accept a user's fetch (e.g. https://www.npmjs.com/package/isomorphic-unfetch).

I understand that this adds a complexity, but if you are willing to accept it, I can send a PR.

@sindresorhus
Copy link
Owner

Not sure I want to add an option for this, as it will enable users to supply a implementation that is not fully Fetch-compliant and then complain to me if something breaks. For example, unfetch is missing a lot and node-fetch is missing stuff too. I don't want to be forced to cater to those incomplete implementations.

@sindresorhus
Copy link
Owner

When #53 is fixed, you can just override the globals yourself with node-fetch.

@prichodko
Copy link
Author

Haven't tried it yet, but I believe with the land of f107e7b we can close this.

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

2 participants