Skip to content

Commit

Permalink
test: replace anonymous closure functions with arrow functions
Browse files Browse the repository at this point in the history
PR-URL: #24443
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
tpanthera authored and BethGriggs committed Feb 11, 2019
1 parent 28a1cc1 commit 7dee5e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-http-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 7dee5e5

Please sign in to comment.