Skip to content

Commit d1ad43e

Browse files
juanarboladuh95
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 cfe28b1 commit d1ad43e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy