mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
4a40ea6894
Use arrow functions for callbacks. Replace uses of `this` with explicit variables. Add a trailing comma in a multiline object literal declaration. PR-URL: https://github.com/nodejs/node/pull/26881 Fixes: https://github.com/https://github.com/nodejs/node/issues/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>
35 lines
863 B
JavaScript
35 lines
863 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const https = require('https');
|
|
const assert = require('assert');
|
|
|
|
{
|
|
const server = https.createServer({
|
|
cert: fixtures.readKey('agent1-cert.pem'),
|
|
key: fixtures.readKey('agent1-key.pem'),
|
|
}, common.mustCall((req, res) => {
|
|
server.close();
|
|
res.end();
|
|
}));
|
|
|
|
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,
|
|
}, common.mustCall(() => {
|
|
assert.strictEqual(req.socket.localPort, common.PORT);
|
|
assert.strictEqual(req.socket.remotePort, port);
|
|
}));
|
|
}));
|
|
}
|