From aab60b499d0a3802baf28ef8edba89dff933ac99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sun, 3 Nov 2024 23:56:20 -0500 Subject: [PATCH] test: improve test coverage for `ServerResponse` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juan José Arboleda --- test/parallel/test-http-write-head.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index e132f607ba0ec7..1093a3ce5d60ca 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -51,6 +51,12 @@ const s = http.createServer(common.mustCall((req, res) => { } ); + assert.throws(() => { + res.writeHead(200, ['invalid', 'headers', 'args']); + }, { + code: 'ERR_INVALID_ARG_VALUE' + }); + res.writeHead(200, { Test: '2' }); assert.throws(() => { @@ -78,7 +84,9 @@ function runTest() { { const server = http.createServer(common.mustCall((req, res) => { - res.writeHead(200, [ 'test', '1' ]); + res.writeHead(220, [ 'test', '1' ]); // 220 is not a standard status code + assert.strictEqual(res.statusMessage, 'unknown'); + assert.throws(() => res.writeHead(200, [ 'test2', '2' ]), { code: 'ERR_HTTP_HEADERS_SENT', name: 'Error',