Skip to content

Commit 17abc8c

Browse files
Trotttargos
authored andcommitted
test: favor arrow functions for anonymous callbacks
In test-https-agent-additional-options, use arrow functions for anonymous callbacks. Replace a use of `this` with the relevant constant. PR-URL: #27830 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 155b947 commit 17abc8c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎test/parallel/test-https-agent-additional-options.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const options = {
1515
minVersion: 'TLSv1.1',
1616
};
1717

18-
constserver=https.Server(options,function(req,res){
18+
constserver=https.Server(options,(req,res)=>{
1919
res.writeHead(200);
2020
res.end('hello world\n');
2121
});
@@ -45,9 +45,9 @@ function variations(iter, port, cb) {
4545
returncommon.mustCall(cb);
4646
}else{
4747
const[key,val]=value;
48-
returncommon.mustCall(function(res){
48+
returncommon.mustCall((res)=>{
4949
res.resume();
50-
https.globalAgent.once('free',common.mustCall(function(){
50+
https.globalAgent.once('free',common.mustCall(()=>{
5151
https.get(
5252
Object.assign({},getBaseOptions(port),{[key]: val}),
5353
variations(iter,port,cb)
@@ -57,16 +57,16 @@ function variations(iter, port, cb) {
5757
}
5858
}
5959

60-
server.listen(0,common.mustCall(function(){
61-
constport=this.address().port;
60+
server.listen(0,common.mustCall(()=>{
61+
constport=server.address().port;
6262
constglobalAgent=https.globalAgent;
6363
globalAgent.keepAlive=true;
6464
https.get(getBaseOptions(port),variations(
6565
updatedValues.entries(),
6666
port,
67-
common.mustCall(function(res){
67+
common.mustCall((res)=>{
6868
res.resume();
69-
globalAgent.once('free',common.mustCall(function(){
69+
globalAgent.once('free',common.mustCall(()=>{
7070
// Verify that different keep-alived connections are created
7171
// for the base call and each variation
7272
constkeys=Object.keys(globalAgent.freeSockets);

0 commit comments

Comments
 (0)