mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: improve test coverage for ServerResponse
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: https://github.com/nodejs/node/pull/55711 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
parent
7788999ac1
commit
6970a77eb4
@ -51,6 +51,12 @@ const s = http.createServer(common.mustCall((req, res) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.throws(() => {
|
||||||
|
res.writeHead(200, ['invalid', 'headers', 'args']);
|
||||||
|
}, {
|
||||||
|
code: 'ERR_INVALID_ARG_VALUE'
|
||||||
|
});
|
||||||
|
|
||||||
res.writeHead(200, { Test: '2' });
|
res.writeHead(200, { Test: '2' });
|
||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
@ -78,7 +84,9 @@ function runTest() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const server = http.createServer(common.mustCall((req, res) => {
|
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' ]), {
|
assert.throws(() => res.writeHead(200, [ 'test2', '2' ]), {
|
||||||
code: 'ERR_HTTP_HEADERS_SENT',
|
code: 'ERR_HTTP_HEADERS_SENT',
|
||||||
name: 'Error',
|
name: 'Error',
|
||||||
|
Loading…
Reference in New Issue
Block a user