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);