From 70e4fb8ca1c1b6c5adcc7cc02af87dcfa9d1d1f4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 9 Dec 2016 16:08:05 -0800 Subject: [PATCH] test: refactor test-http-pause-resume-one-end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * setTimeout() with no duration -> setImmediate() * var -> const * remove unused variable `chunk` PR-URL: https://github.com/nodejs/node/pull/10210 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: Michaƫl Zasso --- test/parallel/test-http-pause-resume-one-end.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-http-pause-resume-one-end.js b/test/parallel/test-http-pause-resume-one-end.js index 2ebd3cbe619ac7..6b98246cc271ac 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(); }); }));