aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-05-21 13:45:13 -0700
committerRich Trott <rtrott@gmail.com>2019-05-24 19:26:39 -0700
commitd03cff7620f0a62433f36abc252532ab0a79a56c (patch)
treeef7b56efb6cf13ddc424d7044b3c8e240efeee97 /test
parent3f01710d3ce89518825c7216975d544d6e78afb2 (diff)
downloadandroid-node-v8-d03cff7620f0a62433f36abc252532ab0a79a56c.tar.gz
android-node-v8-d03cff7620f0a62433f36abc252532ab0a79a56c.tar.bz2
android-node-v8-d03cff7620f0a62433f36abc252532ab0a79a56c.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-https-agent-additional-options.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/parallel/test-https-agent-additional-options.js b/test/parallel/test-https-agent-additional-options.js
index 2c043cc18e..2a5bde72a0 100644
--- a/test/parallel/test-https-agent-additional-options.js
+++ b/test/parallel/test-https-agent-additional-options.js
@@ -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');
});
@@ -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)
@@ -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);