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

.FetchStream and .CookieJar missing? #4

Open
mk-pmb opened this issue Oct 9, 2017 · 7 comments
Open

.FetchStream and .CookieJar missing? #4

mk-pmb opened this issue Oct 9, 2017 · 7 comments

Comments

@mk-pmb
Copy link
Contributor

mk-pmb commented Oct 9, 2017

I tried to use omni-fetch instead of the regular fetch module in order to get proxy support, but it seems to lack .FetchStream and .CookieJar:

Object.keys(require('omni-fetch') only shows default, and

  function CustomFetchStream(url) {
    return omnifetch.FetchStream.call(this, url, opt);
  }

throws TypeError: Cannot read property 'call' of undefined

Probably an upstream problem: matthew-andrews/isomorphic-fetch#150

@matthew-andrews
Copy link

I don't think either of these are in the WHATWG Fetch standard. Which is the ‘regular fetch module’ you speak?

@mk-pmb
Copy link
Contributor Author

mk-pmb commented Oct 10, 2017

I meant the one on npm: https://www.npmjs.com/package/fetch
Sorry for disregarding the existence of other JS package managers. ;-)

@matthew-andrews
Copy link

matthew-andrews commented Oct 10, 2017

Oh, I see the confusion.

This module (and I suppose omni-fetch) all try to match the WHATWG Fetch specification, which is defined here: https://github.com/whatwg/fetch/, which lacks CookieJar and FetchStream.

Therefore, the lack of CookieJar and FetchStream is intentional and correct, at least in isomorphic-fetch — and probably in omni-fetch too.

I believe the fetch module that is on NPM predates this specification and it therefore has an API that is not compatible with the WHATWG Fetch specification, isomorphic-fetch and other modules, like omni-fetch.

@marionebl
Copy link
Owner

@matthew-andrews is right about omni-fetch trying to match the fetch standard (with the addition of proxy support in Node.js).

It does so by using using isomorphic-fetch, which in turn uses node-fetch in Node.js runtimes and the whatwg-fetch in Browser runtimes.

omni-fetch exposes exactly the features and symbols found in isomorphic-fetch without custom additions unrelated to proxy support.

Let's try and aks with fetch if they are okay with giving up the package name in favour of node-fetch to avoid this confusion in the future.

@matthew-andrews
Copy link

matthew-andrews commented Oct 10, 2017

node-fetch is already taken by the node implementation of whatwg that isomorphic-fetch relies on (isomorphic fetch doesn't really do anything, honestly…): https://github.com/bitinn/node-fetch.

Maybe a big warning on the fetch readme is all we can do ☹️

@marionebl
Copy link
Owner

What I meant:

  • node-fetch keeps its name
  • fetch switches to a different name with the next major
  • node-fetch takes up fetch as an alias with the next major version

Writing this down I realise this is to much of an hassle to organise and convince people of. Just confusing in different ways, too. Let's go with the readme PR to https://github.com/andris9/fetch

@mk-pmb
Copy link
Contributor Author

mk-pmb commented Oct 10, 2017

Looks like I can have either browser-compat XOR cookies. A warning in the merely-compliant fetchs' readmes would be nice as well.

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