Skip to content

Commit a0acd91

Browse files
jasnellMylesBorins
authored andcommitted
doc: caution against removing pseudoheaders
PR-URL: #17329 Fixes: #15312 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
1 parent 63f6947 commit a0acd91

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/api/http2.md

+12
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,18 @@ console.log(request.headers);
21272127

21282128
See [Headers Object][].
21292129

2130+
*Note*: In HTTP/2, the request path, host name, protocol, and method are
2131+
represented as special headers prefixed with the `:` character (e.g. `':path'`).
2132+
These special headers will be included in the `request.headers` object. Care
2133+
must be taken not to inadvertently modify these special headers or errors may
2134+
occur. For instance, removing all headers from the request will cause errors
2135+
to occur:
2136+
2137+
```js
2138+
removeAllHeaders(request.headers);
2139+
assert(request.url); // Fails because the :path header has been removed
2140+
```
2141+
21302142
#### request.httpVersion
21312143
<!-- YAML
21322144
added: v8.4.0

0 commit comments

Comments
 (0)