From 51e660ae2a557358a3f042d215717a2b658a29b2 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17329 Fixes: https://github.com/nodejs/node/issues/15312 Reviewed-By: Anna Henningsen Reviewed-By: Jon Moss Reviewed-By: Anatoli Papirovski Reviewed-By: Refael Ackermann Reviewed-By: Tobias Nießen Reviewed-By: Timothy Gu --- doc/api/http2.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index f0ad7fe6c9a494..6ff82ae56f4729 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