Skip to content

Commit 7dee5e5

Browse files
tpantheraBethGriggs
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 28a1cc1 commit 7dee5e5

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
@@ -27,26 +27,26 @@ if (!common.hasMultiLocalhost())
2727
const http = require('http');
2828
const assert = require('assert');
2929

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

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

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

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

0 commit comments

Comments
 (0)