Skip to content

Commit

Permalink
test: refactor test-http-pause-resume-one-end
Browse files Browse the repository at this point in the history
* setTimeout() with no duration -> setImmediate()
* var -> const
* remove unused variable `chunk`

PR-URL: #10210
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Jan 31, 2017
1 parent b0a5a3b commit 70e4fb8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-http-pause-resume-one-end.js
Original file line number Diff line number Diff line change
@@ -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();
});
}));
Expand Down

0 comments on commit 70e4fb8

Please sign in to comment.