mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
test: fix http-response-multiheaders
Make sure the server is not closed until both responses have been received. PR-URL: https://github.com/nodejs/node/pull/3958 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit is contained in:
1 parent
b094402937
commit
025e4aaf37
1 file changed
+2
-1
@@ -48,6 +48,7 @@ const server = http.createServer(function(req, res) {
|
||||
});
|
||||
|
||||
server.listen(common.PORT, common.mustCall(function() {
|
||||
var count = 0;
|
||||
for (let n = 1; n <= 2 ; n++) {
|
||||
// this runs twice, the first time, the server will use
|
||||
// setHeader, the second time it uses writeHead. The
|
||||
@@ -58,7 +59,7 @@ server.listen(common.PORT, common.mustCall(function() {
|
||||
http.get(
|
||||
{port:common.PORT, headers:{'x-num': n}},
|
||||
common.mustCall(function(res) {
|
||||
if (n == 2) server.close();
|
||||
if (++ count === 2) server.close();
|
||||
assert.equal(res.headers['content-length'], 1);
|
||||
for (const name of norepeat) {
|
||||
assert.equal(res.headers[name], 'A');
|
||||
|
||||
Reference in new issue
Block a user