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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 155b947 commit 17abc8c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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-
const server = https.Server(options, function(req, res) {
18+
const server = 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
return common.mustCall(cb);
4646
} else {
4747
const [key, val] = value;
48-
return common.mustCall(function(res) {
48+
return common.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-
const port = this.address().port;
60+
server.listen(0, common.mustCall(() => {
61+
const port = server.address().port;
6262
const globalAgent = 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
const keys = Object.keys(globalAgent.freeSockets);

0 commit comments

Comments
 (0)