Fetch API has landed into Node.js
51–60 of 210 posts
Re: Fetch API has landed into Node.js
#52Re: Fetch API has landed into Node.js
#53One thing I hate about fetch() is that you can't manually follow redirects. Using { redirect: 'manual' } doesn't expose the Location header of the redirect, so it's essentially useless. I know that node-fetch fixed this issue, so I hope the official Node fetch() does not have the same problem.
Re: Fetch API has landed into Node.js
#54Earlier quoted context omitted.
Quick question, judging from the commit alone this seems like a rather small change. I assume there's more to it though. I just wonder how come features like this that kind of seems obvious to include in the ecosystem takes quite some time to land? I understand the reality is more complex perhaps, so I am genuinely curious. I hope you realize no disrespect, this will greatly improve the daily work for me since I use…
my guess is that this adds stuff to the global object which has backwards compatibility concerns. And with every public API: Once you add it, you can't really hope to ever change it and even bug-fixes could be breaking some user's code (because they relied on the bug), so you have to be very careful to ship your public API as bug-free as possible.
And this is no obscure corner case, ts-node is huge
Re: Fetch API has landed into Node.js
#55Why it took so long? e.g. Deno had fetch support for ages
Basically because fetch isn't a great API for servers it took a while to get consensus on actually landing it for the interoprability/simple API value. Then it took a while to get consensus it's fine to do even if we can't implement the standard fully and diverge from it on stuff like CORS (like Deno does). Then there were a bunch of work adding APIs like `EventTarget` and `AbortSignal` to Node.js which are quirky'is…
Re: Fetch API has landed into Node.js
#56One thing I hate about fetch() is that you can't manually follow redirects. Using { redirect: 'manual' } doesn't expose the Location header of the redirect, so it's essentially useless. I know that node-fetch fixed this issue, so I hope the official Node fetch() does not have the same problem.
We are not, this is a place the server-side implementation is going to diverge and this was discussed in the PR: https://github.com/nodejs/node/pull/41749#issuecomment-10254...
Re: Fetch API has landed into Node.js
#57Hey, Node core person here (and the person who triggered the land) - we're super excited for this and would love help and feedback. This is still experimental and we'd love to hear from the community what you'd like to see.
Is there any chance to break spec and allow manual redirect handling? the fetch API makes a lot of sense in a browser, but imo this is a pretty crucial feature that undici's implementation lacks. [0] Deno decided to break spec [1][2] so the following code works fine: fetch('https://httpbin.org/status/302', {redirect: 'manual'}) .then(res => console.log(res.status, res.headers)) In undici this will succeed but with re…
Re: Fetch API has landed into Node.js
#58Earlier quoted context omitted.
Is there any chance to break spec and allow manual redirect handling? the fetch API makes a lot of sense in a browser, but imo this is a pretty crucial feature that undici's implementation lacks. [0] Deno decided to break spec [1][2] so the following code works fine: fetch('https://httpbin.org/status/302', {redirect: 'manual'}) .then(res => console.log(res.status, res.headers)) In undici this will succeed but with re…
A better idea would be to replace / improve the fetch spec. Handle redirects, set JSON as the default request content type, encode URI components for users, decode response bodies with JSON headers as JS objects, etc. Right now most developers either write their own library to do these things on top of fetch or another HTTP client or use a third party library from npm. A new standard would allow us to make http reque…
The level of collaboration and good-faith we've been getting from spec bodies like WHATWG is very high as it is and we really don't want to push or abuse it.
Re: Fetch API has landed into Node.js
#59Undici seems to be an HTTP 1.1 client. Is there any work or timescale to provide HTTP 2 support?
Re: Fetch API has landed into Node.js
#60Which NodeJS versions will this be landed to?