0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

dns: honor the order option

Fixes: https://github.com/nodejs/node/issues/55391
PR-URL: https://github.com/nodejs/node/pull/55392
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
Luigi Pinca 2024-10-17 15:18:28 +02:00 committed by GitHub
parent 70fcb87af4
commit 123982d11d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -193,7 +193,7 @@ function lookup(hostname, options, callback) {
}
if (options?.order != null) {
validateOneOf(options.order, 'options.order', ['ipv4first', 'ipv6first', 'verbatim']);
dnsOrder = options.dnsOrder;
dnsOrder = options.order;
}
}

View File

@ -46,4 +46,14 @@ function allowFailed(fn) {
await allowFailed(dnsPromises.lookup('example.org', {}));
checkParameter(cares.DNS_ORDER_VERBATIM);
await allowFailed(
promisify(dns.lookup)('example.org', { order: 'ipv4first' })
);
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
await allowFailed(
promisify(dns.lookup)('example.org', { order: 'ipv6first' })
);
checkParameter(cares.DNS_ORDER_IPV6_FIRST);
})().then(common.mustCall());