Skip to content

Commit

Permalink
test: change anonymous function to arrow function
Browse files Browse the repository at this point in the history
PR-URL: nodejs#24528
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
codegagan authored and refack committed Jan 10, 2019
1 parent edcc4e6 commit 8429dd0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/parallel/test-http-client-timeout-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const options = {
host: '127.0.0.1',
};

const server = http.createServer(function(req, res) {
const server = http.createServer((req, res) => {
const m = /\/(.*)/.exec(req.url);
const reqid = parseInt(m[1], 10);
if (reqid % 2) {
Expand All @@ -51,7 +51,7 @@ server.listen(0, options.host, function() {
options.path = `/${requests_sent}`;
const req = http.request(options);
req.id = requests_sent;
req.on('response', function(res) {
req.on('response', (res) => {
res.on('data', function(data) {
console.log(`res#${this.req.id} data:${data}`);
});
Expand All @@ -78,7 +78,7 @@ server.listen(0, options.host, function() {

setTimeout(function maybeDone() {
if (requests_done >= requests_sent) {
setTimeout(function() {
setTimeout(() => {
server.close();
}, 100);
} else {
Expand All @@ -87,7 +87,7 @@ server.listen(0, options.host, function() {
}, 100);
});

process.on('exit', function() {
process.on('exit', () => {
console.error(`done=${requests_done} sent=${requests_sent}`);
// check that timeout on http request was not called too much
assert.strictEqual(requests_done, requests_sent);
Expand Down

0 comments on commit 8429dd0

Please sign in to comment.