Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: replace Function with Arrow Function to test-http-pause.js
  • Loading branch information
kjunichi committed Nov 26, 2017
commit df87f886e4f6a1caa94d089dad7870fba8355e8d
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);
});