We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 956198f commit f3c1158Copy full SHA for f3c1158
test/parallel/test-http-parser-free.js
@@ -2,13 +2,15 @@
2
require('../common');
3
const assert = require('assert');
4
const http = require('http');
5
+const Countdown = require('../common/countdown');
6
const N = 100;
-let responses = 0;
7
8
const server = http.createServer(function(req, res) {
9
res.end('Hello');
10
});
11
12
+const countdown = new Countdown(N, () => server.close());
13
+
14
server.listen(0, function() {
15
http.globalAgent.maxSockets = 1;
16
let parser;
@@ -21,15 +23,9 @@ server.listen(0, function() {
21
23
assert.strictEqual(req.parser, parser);
22
24
}
25
- if (++responses === N) {
- server.close();
26
- }
+ countdown.dec();
27
res.resume();
28
29
})(i);
30
31
32
-
33
-process.on('exit', function() {
34
- assert.strictEqual(responses, N);
35
-});
0 commit comments