From 82376015abb92ad28bd88a79d5d1fa450aa25c2d Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:41:14 +0530 Subject: [PATCH] test: change anonymous function to arrow function PR-URL: https://github.com/nodejs/node/pull/24528 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-http-client-timeout-agent.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index 8ce14f865c269c..2f4aeed97571d3 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -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) { @@ -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}`); }); @@ -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 { @@ -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);