Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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.
  • Loading branch information
Trott committed Mar 23, 2019
commit 277ede3b9e6ebcbae196339147f44da14a279b21
14 changes: 8 additions & 6 deletions test/sequential/test-https-connect-localport.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ const https = require('https');
const assert = require('assert');

{
https.createServer({
const server = https.createServer({
cert: fixtures.readKey('agent1-cert.pem'),
key: fixtures.readKey('agent1-key.pem'),
}, common.mustCall(function(req, res) {
this.close();
}, common.mustCall((req, res) => {
server.close();
res.end();
})).listen(0, 'localhost', common.mustCall(function() {
const port = this.address().port;
}));

server.listen(0, 'localhost', common.mustCall(() => {
const port = server.address().port;
const req = https.get({
host: 'localhost',
pathname: '/',
port,
family: 4,
localPort: common.PORT,
rejectUnauthorized: false
rejectUnauthorized: false,
}, common.mustCall(() => {
assert.strictEqual(req.socket.localPort, common.PORT);
assert.strictEqual(req.socket.remotePort, port);
Expand Down