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 committed Dec 14, 2016
1 parent 3ddbea6 commit 6f02957
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 6f02957

Please sign in to comment.