diff --git a/test/parallel/test-http-pause-resume-one-end.js b/test/parallel/test-http-pause-resume-one-end.js index 2ebd3cbe61..6b98246cc2 100644 --- a/test/parallel/test-http-pause-resume-one-end.js +++ b/test/parallel/test-http-pause-resume-one-end.js @@ -1,23 +1,23 @@ 'use strict'; const common = require('../common'); -var http = require('http'); +const http = require('http'); -var server = http.Server(function(req, res) { +const server = http.Server(function(req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); server.close(); }); server.listen(0, common.mustCall(function() { - var opts = { + const opts = { port: this.address().port, headers: { connection: 'close' } }; http.get(opts, common.mustCall(function(res) { - res.on('data', common.mustCall(function(chunk) { + res.on('data', common.mustCall(function() { res.pause(); - setTimeout(function() { + setImmediate(function() { res.resume(); }); }));