Skip to content

Commit b72fa03

Browse files
kenperkinsbrendanashworth
authored andcommitted
test: adds a test for undefined value in setHeader
As a result of 979d0ca there is a new check for undefined values on OutgoingMessage.setHeader. This commit introduces a test for this case. PR-URL: #970 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Brendan Ashworth <[email protected]>
1 parent 2b79052 commit b72fa03

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ var s = http.createServer(function(req, res) {
1818
}
1919
assert.ok(threw, 'Non-string names should throw');
2020

21+
// undefined value should throw, via 979d0ca8
22+
threw = false;
23+
try {
24+
res.setHeader('foo', undefined);
25+
} catch (e) {
26+
assert.ok(e instanceof Error);
27+
assert.equal(e.message, '`value` required in setHeader("foo", value).');
28+
threw = true;
29+
}
30+
assert.ok(threw, 'Undefined value should throw');
31+
2132
res.writeHead(200, { Test: '2' });
2233
res.end();
2334
});

0 commit comments

Comments
 (0)