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:
parent
70fcb87af4
commit
123982d11d
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user