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 <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 28a1cc1 commit 7dee5e5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎test/parallel/test-http-localaddress.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ if (!common.hasMultiLocalhost())
2727
consthttp=require('http');
2828
constassert=require('assert');
2929

30-
constserver=http.createServer(function(req,res){
30+
constserver=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
constoptions={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
constreq=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)