undici icon indicating copy to clipboard operation
undici copied to clipboard

Spec Deviations

Open ronag opened this issue 2 years ago • 3 comments

I think it would be good if we could agree on long term and short term spec deviations. Maybe base it on: https://deno.land/manual/runtime/web_platform_apis#spec-deviations?

ronag avatar Mar 31 '22 07:03 ronag

@AlttiRi @mcollina @benjamingr @nodejs/undici @nodejs/http

ronag avatar Mar 31 '22 07:03 ronag

Not sure what cloudflare does? @jasnell

ronag avatar Mar 31 '22 07:03 ronag

It looks that all Fetch API specs are actually Fetch API specs mixed with "Browser requests behaviour specs".

The great example is "Fetch Metadata Request Headers" spec, which actually is about every request in browsers, not only made with fetch function.

My opinion that "pure" Fetch API is about fetch, fetchInit, Headers, Request, Response, ReadableStream.

I want fetch in Node.js since I want to use for network requests the convenient, well know API, which I always use in browsers.

As from a Node.js library I expect that it will give me more control than browser's fetch, the example — a custom headers order. Custom set of default headers. What if someone want to set only 4 headers, as is Deno's fetch does (accept, user-agent, accept-encoding, host)?

Extending also looks acceptable, currently Request.body is "async iterable", while the native fetch is not. (In fact it can be done with 10 lines of code for the native fetch.)

AlttiRi avatar Mar 31 '22 08:03 AlttiRi