Skip to content

Commit

Permalink
test: replace function with ES6 arrow function
Browse files Browse the repository at this point in the history
PR-URL: #17306
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
  • Loading branch information
kjunichi authored and MylesBorins committed Dec 12, 2017
1 parent 8e5b711 commit 71eb186
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/parallel/test-http-pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ let resultServer = '';
const expectedClient = 'Response Body from Server';
let resultClient = '';

const server = http.createServer(function(req, res) {
const server = http.createServer((req, res) => {
console.error('pause server request');
req.pause();
setTimeout(function() {
setTimeout(() => {
console.error('resume server request');
req.resume();
req.setEncoding('utf8');
req.on('data', function(chunk) {
req.on('data', (chunk) => {
resultServer += chunk;
});
req.on('end', function() {
req.on('end', () => {
console.error(resultServer);
res.writeHead(200);
res.end(expectedClient);
Expand All @@ -52,16 +52,16 @@ server.listen(0, function() {
port: this.address().port,
path: '/',
method: 'POST'
}, function(res) {
}, (res) => {
console.error('pause client response');
res.pause();
setTimeout(function() {
setTimeout(() => {
console.error('resume client response');
res.resume();
res.on('data', function(chunk) {
res.on('data', (chunk) => {
resultClient += chunk;
});
res.on('end', function() {
res.on('end', () => {
console.error(resultClient);
server.close();
});
Expand All @@ -70,7 +70,7 @@ server.listen(0, function() {
req.end(expectedServer);
});

process.on('exit', function() {
process.on('exit', () => {
assert.strictEqual(expectedServer, resultServer);
assert.strictEqual(expectedClient, resultClient);
});

0 comments on commit 71eb186

Please sign in to comment.