Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions test/parallel/test-http-set-cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const http = require('http');
const Countdown = require('../common/countdown');

let nresponses = 0;

const countdown = new Countdown(2, common.mustCall(() => server.close()));
Copy link
Contributor

@apapirovski apapirovski Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't strictly need the common.mustCall but it's not a deal breaker. (If you do remove it, you'll need to also remove the const common = part above (but keep the actual require).

const server = http.createServer(function(req, res) {
if (req.url === '/one') {
res.writeHead(200, [['set-cookie', 'A'],
Expand Down Expand Up @@ -55,9 +55,7 @@ server.on('listening', function() {
});

res.on('end', function() {
if (++nresponses === 2) {
server.close();
}
countdown.dec();
});
});

Expand All @@ -72,14 +70,9 @@ server.on('listening', function() {
});

res.on('end', function() {
if (++nresponses === 2) {
server.close();
}
countdown.dec();
});
});

});

process.on('exit', function() {
assert.strictEqual(2, nresponses);
});