test: improve coverage of lib/_http_outgoing.js

Refs: https://coverage.nodejs.org/coverage-36bb31be5f0b85a0/lib/_http_outgoing.js.html#L351
Refs: https://coverage.nodejs.org/coverage-36bb31be5f0b85a0/lib/_http_outgoing.js.html#L609

PR-URL: https://github.com/nodejs/node/pull/38734
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rongjian Zhang 2021-05-19 17:27:44 +08:00 committed by James M Snell
parent 5ce015ec72
commit 5a11402223
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const http = require('http');
const Countdown = require('../common/countdown');
@ -13,7 +13,7 @@ const server = http.createServer((req, res) => {
// to call res.writeHead instead
res._writeRaw('HTTP/1.1 102 Processing\r\n');
res._writeRaw('Foo: Bar\r\n');
res._writeRaw('\r\n');
res._writeRaw('\r\n', common.mustCall());
console.error('Server sending full response...');
res.writeHead(200, {
'Content-Type': 'text/plain',

View File

@ -47,6 +47,7 @@ const s = http.createServer(common.mustCall((req, res) => {
const exoticObj = Object.create(null);
assert.deepStrictEqual(headers, exoticObj);
assert.deepStrictEqual(res.getHeaderNames(), []);
assert.deepStrictEqual(res.getRawHeaderNames(), []);
assert.deepStrictEqual(res.hasHeader('Connection'), false);
assert.deepStrictEqual(res.getHeader('Connection'), undefined);