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: https://github.com/nodejs/node/pull/27830 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
3f01710d3c
commit
d03cff7620
@ -15,7 +15,7 @@ const options = {
|
|||||||
minVersion: 'TLSv1.1',
|
minVersion: 'TLSv1.1',
|
||||||
};
|
};
|
||||||
|
|
||||||
const server = https.Server(options, function(req, res) {
|
const server = https.Server(options, (req, res) => {
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end('hello world\n');
|
res.end('hello world\n');
|
||||||
});
|
});
|
||||||
@ -45,9 +45,9 @@ function variations(iter, port, cb) {
|
|||||||
return common.mustCall(cb);
|
return common.mustCall(cb);
|
||||||
} else {
|
} else {
|
||||||
const [key, val] = value;
|
const [key, val] = value;
|
||||||
return common.mustCall(function(res) {
|
return common.mustCall((res) => {
|
||||||
res.resume();
|
res.resume();
|
||||||
https.globalAgent.once('free', common.mustCall(function() {
|
https.globalAgent.once('free', common.mustCall(() => {
|
||||||
https.get(
|
https.get(
|
||||||
Object.assign({}, getBaseOptions(port), { [key]: val }),
|
Object.assign({}, getBaseOptions(port), { [key]: val }),
|
||||||
variations(iter, port, cb)
|
variations(iter, port, cb)
|
||||||
@ -57,16 +57,16 @@ function variations(iter, port, cb) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server.listen(0, common.mustCall(function() {
|
server.listen(0, common.mustCall(() => {
|
||||||
const port = this.address().port;
|
const port = server.address().port;
|
||||||
const globalAgent = https.globalAgent;
|
const globalAgent = https.globalAgent;
|
||||||
globalAgent.keepAlive = true;
|
globalAgent.keepAlive = true;
|
||||||
https.get(getBaseOptions(port), variations(
|
https.get(getBaseOptions(port), variations(
|
||||||
updatedValues.entries(),
|
updatedValues.entries(),
|
||||||
port,
|
port,
|
||||||
common.mustCall(function(res) {
|
common.mustCall((res) => {
|
||||||
res.resume();
|
res.resume();
|
||||||
globalAgent.once('free', common.mustCall(function() {
|
globalAgent.once('free', common.mustCall(() => {
|
||||||
// Verify that different keep-alived connections are created
|
// Verify that different keep-alived connections are created
|
||||||
// for the base call and each variation
|
// for the base call and each variation
|
||||||
const keys = Object.keys(globalAgent.freeSockets);
|
const keys = Object.keys(globalAgent.freeSockets);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user