Skip to content

Commit 8742090

Browse files
santigimenoFishrock123
authored andcommitted
test: fix http-response-multiheaders
Make sure the server is not closed until both responses have been received. PR-URL: #3958 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent e79eda7 commit 8742090

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/parallel/test-http-response-multiheaders.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const server = http.createServer(function(req, res) {
4848
});
4949

5050
server.listen(common.PORT, common.mustCall(function() {
51+
var count = 0;
5152
for (let n = 1; n <= 2 ; n++) {
5253
// this runs twice, the first time, the server will use
5354
// setHeader, the second time it uses writeHead. The
@@ -58,7 +59,7 @@ server.listen(common.PORT, common.mustCall(function() {
5859
http.get(
5960
{port:common.PORT, headers:{'x-num': n}},
6061
common.mustCall(function(res) {
61-
if (n == 2) server.close();
62+
if (++ count === 2) server.close();
6263
assert.equal(res.headers['content-length'], 1);
6364
for (const name of norepeat) {
6465
assert.equal(res.headers[name], 'A');

0 commit comments

Comments
 (0)