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 <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
Trott authored and evanlucas committed Dec 14, 2016
1 parent 90659bc commit 2f9c8d9
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 2f9c8d9

Please sign in to comment.