test: adds a test for undefined value in setHeader
As a result of 979d0ca8 there is a new check for undefined values on OutgoingMessage.setHeader. This commit introduces a test for this case. PR-URL: https://github.com/iojs/io.js/pull/970 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
This commit is contained in:
parent
2b79052494
commit
b72fa03057
@ -18,6 +18,17 @@ var s = http.createServer(function(req, res) {
|
|||||||
}
|
}
|
||||||
assert.ok(threw, 'Non-string names should throw');
|
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.writeHead(200, { Test: '2' });
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user