Permalink
Browse files

test: Use common.mustCall in http test

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 gibfahn committed Dec 6, 2017
1 parent ee52ce9 commit d4d3f50f9df3b2266d5494eeb54e6ce2445153cf
Showing with 4 additions and 13 deletions.
  1. +4 −13 test/parallel/test-http-pipeline-regr-2639.js
@@ -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 d4d3f50

Please sign in to comment.