From 7f607541ff155433353caff7b73a72015adf847e Mon Sep 17 00:00:00 2001 From: tpanthera Date: Sat, 17 Nov 2018 18:46:19 +0530 Subject: [PATCH] test: replace anonymous closure functions with arrow functions PR-URL: https://github.com/nodejs/node/pull/24443 Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-http-localaddress.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 1c81203ff163eb..2b4c88d1e5155c 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -27,26 +27,26 @@ if (!common.hasMultiLocalhost()) const http = require('http'); const assert = require('assert'); -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { console.log(`Connect from: ${req.connection.remoteAddress}`); assert.strictEqual(req.connection.remoteAddress, '127.0.0.2'); - req.on('end', function() { + req.on('end', () => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(`You are from: ${req.connection.remoteAddress}`); }); req.resume(); }); -server.listen(0, '127.0.0.1', function() { +server.listen(0, '127.0.0.1', () => { const options = { host: 'localhost', - port: this.address().port, + port: server.address().port, path: '/', method: 'GET', localAddress: '127.0.0.2' }; const req = http.request(options, function(res) { - res.on('end', function() { + res.on('end', () => { server.close(); process.exit(); });