Skip to content

Commit

Permalink
test: favor arrow functions for anonymous callbacks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott authored and targos committed May 28, 2019
1 parent 155b947 commit 17abc8c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/parallel/test-https-agent-additional-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const options = {
minVersion: 'TLSv1.1',
};

const server = https.Server(options, function(req, res) {
const server = https.Server(options, (req, res) => {
res.writeHead(200);
res.end('hello world\n');
});
Expand Down Expand Up @@ -45,9 +45,9 @@ function variations(iter, port, cb) {
return common.mustCall(cb);
} else {
const [key, val] = value;
return common.mustCall(function(res) {
return common.mustCall((res) => {
res.resume();
https.globalAgent.once('free', common.mustCall(function() {
https.globalAgent.once('free', common.mustCall(() => {
https.get(
Object.assign({}, getBaseOptions(port), { [key]: val }),
variations(iter, port, cb)
Expand All @@ -57,16 +57,16 @@ function variations(iter, port, cb) {
}
}

server.listen(0, common.mustCall(function() {
const port = this.address().port;
server.listen(0, common.mustCall(() => {
const port = server.address().port;
const globalAgent = https.globalAgent;
globalAgent.keepAlive = true;
https.get(getBaseOptions(port), variations(
updatedValues.entries(),
port,
common.mustCall(function(res) {
common.mustCall((res) => {
res.resume();
globalAgent.once('free', common.mustCall(function() {
globalAgent.once('free', common.mustCall(() => {
// Verify that different keep-alived connections are created
// for the base call and each variation
const keys = Object.keys(globalAgent.freeSockets);
Expand Down

0 comments on commit 17abc8c

Please sign in to comment.