Skip to content

Commit

Permalink
test: adds a test for undefined value in setHeader
Browse files Browse the repository at this point in the history
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 <rod@vagg.org>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
  • Loading branch information
kenperkins authored and brendanashworth committed Mar 5, 2015
1 parent 2b79052 commit b72fa03
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/parallel/test-http-write-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ var s = http.createServer(function(req, res) {
}
assert.ok(threw, 'Non-string names should throw');

// undefined value should throw, via 979d0ca8
threw = false;
try {
res.setHeader('foo', undefined);
} catch (e) {
assert.ok(e instanceof Error);
assert.equal(e.message, '`value` required in setHeader("foo", value).');
threw = true;
}
assert.ok(threw, 'Undefined value should throw');

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

0 comments on commit b72fa03

Please sign in to comment.