From 635d77a951c0eb291bd1c1949abf9476a17297d2 Mon Sep 17 00:00:00 2001 From: Nathanael BOT Date: Fri, 6 Mar 2026 13:05:50 +0100 Subject: [PATCH] docs(fetch): document forbidden request headers Signed-off-by: Nathanael BOT --- docs/docs/api/Fetch.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/docs/api/Fetch.md b/docs/docs/api/Fetch.md index 00c349847dc..90943a4cb3d 100644 --- a/docs/docs/api/Fetch.md +++ b/docs/docs/api/Fetch.md @@ -22,6 +22,20 @@ This API is implemented as per the standard, you can find documentation on [MDN] This API is implemented as per the standard, you can find documentation on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Headers) +### Forbidden headers + +Undici follows the Fetch specification rules for forbidden header names. +This means some browser-controlled headers cannot be set manually in +`fetch()` or `new Request()` calls. + +For example, setting a `connection` header will throw an error such as +`InvalidArgumentError: invalid connection header`. + +If your code is migrating from another HTTP client, remove these headers +and let Undici manage connection-level behavior. + +See the [Fetch standard's list of forbidden request-header names](https://fetch.spec.whatwg.org/#forbidden-request-header). + # Body Mixins `Response` and `Request` body inherit body mixin methods. These methods include: