From cabf67ac536107d8d821847fc3ef845fad15dac1 Mon Sep 17 00:00:00 2001 From: Shivay-98 Date: Mon, 22 Jun 2026 22:05:29 +0530 Subject: [PATCH 1/2] http2: add headersDistinct to Http2ServerRequest Signed-off-by: Shivay-98 --- doc/api/http2.md | 47 +++++++++++++++++++ lib/internal/http2/compat.js | 25 ++++++++++ ...test-http2-compat-serverrequest-headers.js | 19 ++++++++ 3 files changed, 91 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 9773a73b1c5288..59e5ff01827634 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -4189,6 +4189,53 @@ removeAllHeaders(request.headers); assert(request.url); // Fails because the :path header has been removed ``` +#### `request.headersDistinct` + + + +* Type: {Object} + +Similar to [`request.headers`][], but there is no join logic and the values are +always arrays of strings, even for headers received just once. + +The object has a null prototype and should not be accessed using the `in` +operator. + +```js +// Prints something like: +// +// { 'user-agent': ['curl/7.22.0'], +// host: ['127.0.0.1:8000'], +// accept: ['*/*'] } +console.log(request.headersDistinct); +``` + + + +* Type: {Object} + +Similar to `request.headers`, but preserves duplicate header values. +Each property is an array containing all values received for that header. + +The object has a null prototype and should not be accessed using the `in` +operator. + +```js +// Prints something like: +// +// { +// host: ['127.0.0.1:8000'], +// accept: ['text/html', 'application/json'] +// } +console.log(request.headersDistinct); +``` + #### `request.httpVersion`