Skip to content

Commit

Permalink
test: Use common.mustCall in http test
Browse files Browse the repository at this point in the history
PR-URL: #17487
Refs: #17169
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
  • Loading branch information
sreepurnajasti authored and apapirovski committed Dec 8, 2017
1 parent 4e65f9d commit f81bb7b
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions test/parallel/test-http-pipeline-regr-2639.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
'use strict';
require('../common');
const assert = require('assert');
const common = require('../common');
const http = require('http');
const net = require('net');

const COUNT = 10;

let received = 0;

const server = http.createServer(function(req, res) {
const server = http.createServer(common.mustCall((req, res) => {
// Close the server, we have only one TCP connection anyway
if (received++ === 0)
server.close();

server.close();
res.writeHead(200);
res.write('data');

setTimeout(function() {
res.end();
}, (Math.random() * 100) | 0);
}).listen(0, function() {
}, COUNT)).listen(0, function() {
const s = net.connect(this.address().port);

const big = 'GET / HTTP/1.0\r\n\r\n'.repeat(COUNT);

s.write(big);
s.resume();
});

process.on('exit', function() {
assert.strictEqual(received, COUNT);
});

0 comments on commit f81bb7b

Please sign in to comment.