mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05: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:
1 parent
cfe28b161a
commit
d1ad43e9ae
1 file changed
+9
-1
@@ -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' });
|
||||
|
||||
assert.throws(() => {
|
||||
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user