Skip to content

Commit 3cae010

Browse files
Trotttargos
authored andcommitted
test: refactor test-https-connect-localport
Use arrow functions for callbacks. Replace uses of `this` with explicit variables. Add a trailing comma in a multiline object literal declaration. PR-URL: #26881 Fixes: #26862 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 838fb95 commit 3cae010

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/sequential/test-https-connect-localport.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@ const https = require('https');
99
const assert = require('assert');
1010

1111
{
12-
https.createServer({
12+
const server = https.createServer({
1313
cert: fixtures.readKey('agent1-cert.pem'),
1414
key: fixtures.readKey('agent1-key.pem'),
15-
}, common.mustCall(function(req, res) {
16-
this.close();
15+
}, common.mustCall((req, res) => {
16+
server.close();
1717
res.end();
18-
})).listen(0, 'localhost', common.mustCall(function() {
19-
const port = this.address().port;
18+
}));
19+
20+
server.listen(0, 'localhost', common.mustCall(() => {
21+
const port = server.address().port;
2022
const req = https.get({
2123
host: 'localhost',
2224
pathname: '/',
2325
port,
2426
family: 4,
2527
localPort: common.PORT,
26-
rejectUnauthorized: false
28+
rejectUnauthorized: false,
2729
}, common.mustCall(() => {
2830
assert.strictEqual(req.socket.localPort, common.PORT);
2931
assert.strictEqual(req.socket.remotePort, port);

0 commit comments

Comments
 (0)