Skip to content

Commit abb1c64

Browse files
tpantheratargos
authored andcommitted
test: replace anonymous closure functions with arrow functions
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]>
1 parent 955819e commit abb1c64

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/parallel/test-http-localaddress.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@ if (!common.hasMultiLocalhost())
2828
const http = require('http');
2929
const assert = require('assert');
3030

31-
const server = http.createServer(function(req, res) {
31+
const server = http.createServer((req, res) => {
3232
console.log(`Connect from: ${req.connection.remoteAddress}`);
3333
assert.strictEqual(req.connection.remoteAddress, '127.0.0.2');
3434

35-
req.on('end', function() {
35+
req.on('end', () => {
3636
res.writeHead(200, { 'Content-Type': 'text/plain' });
3737
res.end(`You are from: ${req.connection.remoteAddress}`);
3838
});
3939
req.resume();
4040
});
4141

42-
server.listen(0, '127.0.0.1', function() {
42+
server.listen(0, '127.0.0.1', () => {
4343
const options = { host: 'localhost',
44-
port: this.address().port,
44+
port: server.address().port,
4545
path: '/',
4646
method: 'GET',
4747
localAddress: '127.0.0.2' };
4848

4949
const req = http.request(options, function(res) {
50-
res.on('end', function() {
50+
res.on('end', () => {
5151
server.close();
5252
process.exit();
5353
});

0 commit comments

Comments
 (0)