Skip to content

Commit

Permalink
test: improve test coverage for ServerResponse
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <[email protected]>
  • Loading branch information
juanarbol committed Nov 4, 2024
1 parent 8807549 commit fc40e7b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/parallel/test-http-write-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ const s = http.createServer(common.mustCall((req, res) => {
}
);

assert.throws(() => {
res.writeHead(200, { meow: 'meow' }, ['invalid', 'headers', 'args']);
}, {
code: 'ERR_INVALID_ARG_VALUE'
});

res.writeHead(200, { Test: '2' });

assert.throws(() => {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit fc40e7b

Please sign in to comment.