mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

Make `tls.connect()` support the `hints` option for feature parity with `net.connect()`. PR-URL: https://github.com/nodejs/node/pull/27816 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
27 lines
633 B
JavaScript
27 lines
633 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
// This test verifies that `tls.connect()` honors the `hints` option.
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const dns = require('dns');
|
|
const tls = require('tls');
|
|
|
|
const hints = 512;
|
|
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG);
|
|
assert.notStrictEqual(hints, dns.V4MAPPED);
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED);
|
|
|
|
tls.connect({
|
|
lookup: common.mustCall((host, options) => {
|
|
assert.strictEqual(host, 'localhost');
|
|
assert.deepStrictEqual(options, { family: undefined, hints });
|
|
}),
|
|
hints
|
|
});
|