Skip to content

Commit a999879

Browse files
juanarbolmarco-ippolito
authored andcommitted
test: improve test coverage for ServerResponse
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #55711 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent c3913f9 commit a999879

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/parallel/test-http-write-head.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ const s = http.createServer(common.mustCall((req, res) => {
5151
}
5252
);
5353

54+
assert.throws(() => {
55+
res.writeHead(200, ['invalid', 'headers', 'args']);
56+
}, {
57+
code: 'ERR_INVALID_ARG_VALUE'
58+
});
59+
5460
res.writeHead(200, { Test: '2' });
5561

5662
assert.throws(() => {
@@ -78,7 +84,9 @@ function runTest() {
7884

7985
{
8086
const server = http.createServer(common.mustCall((req, res) => {
81-
res.writeHead(200, [ 'test', '1' ]);
87+
res.writeHead(220, [ 'test', '1' ]); // 220 is not a standard status code
88+
assert.strictEqual(res.statusMessage, 'unknown');
89+
8290
assert.throws(() => res.writeHead(200, [ 'test2', '2' ]), {
8391
code: 'ERR_HTTP_HEADERS_SENT',
8492
name: 'Error',

0 commit comments

Comments
 (0)