From 96cd258136b762f818e7686caf5d198ef9a7b4f6 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 11:12:03 -0800 Subject: [PATCH] doc: caution against removing pseudoheaders Fixes: https://github.com/nodejs/node/issues/15312 --- doc/api/http2.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 3500c563a2782a..ec3cef8aa04408 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2127,6 +2127,18 @@ console.log(request.headers); See [Headers Object][]. +*Note*: In HTTP/2, the request path, host name, protocol, and method are +represented as special headers prefixed with the `:` character (e.g. `':path'`). +These special headers will be included in the `request.headers` object. Care +must be taken not to inadvertently modify these special headers or errors may +occur. For instance, removing all headers from the request will cause errors +to occur: + +```js +removeAllHeaders(request.headers); +assert(request.url); // Fails because the :path header has been removed +``` + #### request.httpVersion