diff --git a/doc/api/globals.md b/doc/api/globals.md index a70442f1bb91ec..2beffb116ba681 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -41,14 +41,14 @@ changes: description: No longer experimental. --> -A utility class used to signal cancelation in selected `Promise`-based APIs. +A utility class used to signal cancellation in selected `Promise`-based APIs. The API is based on the Web API {AbortController}. ```js const ac = new AbortController(); ac.signal.addEventListener('abort', () => console.log('Aborted!'), - { once: true }); + { once: true }); ac.abort(); @@ -595,6 +595,54 @@ The following globals are available to use with `fetch`: * [`Request`][] * [`Response`][] +### Differences from the Fetch Standard + +Node.js's `fetch()` implementation, based on [undici](https://undici.nodejs.org), +has several intentional differences from the +[WHATWG Fetch Standard](https://fetch.spec.whatwg.org/): + +
+
new Response(asyncIterable)
+
+ +The WHATWG Fetch Standard only allows ReadableStream, +BufferSource, Blob, FormData, +URLSearchParams, USVString, or null as +the Response body. Node.js extends this to also accept async +iterables, enabling flexible streaming response construction. + +
+
Cookies handling
+
+ +The Fetch Standard defines automatic cookie management for request and response +headers. Node.js does not provide automatic cookie storage, management, or +transmission. Cookies must be handled manually by the user if needed. + +
+
No forbidden headers enforcement
+
+ +The Fetch Standard restricts certain headers (such as Host, +Connection, Content-Length, User-Agent, +Referer) from being set programmatically. Node.js removes these +restrictions, giving users full control over request and response headers. + +
+
No CORS checks
+
+ +The Fetch Standard enforces Cross-Origin Resource Sharing (CORS) checks, +including preflight requests and validation of CORS response headers. Node.js +does not implement CORS, so all cross-origin requests are allowed without +restriction. + +
+
+ +For a more detailed list of differences, refer to the +[undici documentation](https://github.com/nodejs/undici). + ## Class: `File`