From 8806eac63439a974820ea65dd68aac32b35130fa Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Sun, 26 May 2024 09:32:46 +0200 Subject: fix(node): set default http server response code 200 (#23977) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node sets the default HTTP response status code to 200 on the `ServerResponse`. We initialised it as `undefined` before which caused a problem with 11ty's dev server. Thanks to @vrugtehagel for reporting this issue and finding the correct fix as well 🎉 Fixes https://github.com/denoland/deno/issues/23970 --- tests/unit_node/http_test.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index 0518d935b..9cb409c39 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -1004,6 +1004,12 @@ Deno.test("[node/http] ServerResponse getHeaders", () => { assertEquals(res.getHeaders(), { "bar": "baz", "foo": "bar" }); }); +Deno.test("[node/http] ServerResponse default status code 200", () => { + const req = new http.IncomingMessage(new net.Socket()); + const res = new http.ServerResponse(req); + assertEquals(res.statusCode, 200); +}); + Deno.test("[node/http] maxHeaderSize is defined", () => { assertEquals(http.maxHeaderSize, 16_384); }); -- cgit v1.2.3