From 14ae4f897f3c92fd8f2d4ac06ce7fb3015071d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 21 Apr 2024 03:01:23 +0100 Subject: [PATCH] fix(ext/node): define http.maxHeaderSize (#23479) Closes https://github.com/denoland/deno/issues/23432 --- ext/node/polyfills/http.ts | 3 +++ tests/unit_node/http_test.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 67981e8de4..ceaf7aeb89 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1820,6 +1820,8 @@ export function get(...args: any[]) { return req; } +export const maxHeaderSize = 16_384; + export { Agent, ClientRequest, @@ -1848,4 +1850,5 @@ export default { get, validateHeaderName, validateHeaderValue, + maxHeaderSize, }; diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index 6672b97474..c298f2abb2 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -998,3 +998,7 @@ Deno.test("[node/http] ServerResponse getHeaders", () => { assertEquals(res.getHeaderNames(), ["bar", "foo"]); assertEquals(res.getHeaders(), { "bar": "baz", "foo": "bar" }); }); + +Deno.test("[node/http] maxHeaderSize is defined", () => { + assertEquals(http.maxHeaderSize, 16_384); +});