Skip to content

Commit

Permalink
dns: honor the order option
Browse files Browse the repository at this point in the history
Fixes: #55391
  • Loading branch information
lpinca committed Oct 15, 2024
1 parent 51d8146 commit 6b90982
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
10 changes: 10 additions & 0 deletions test/parallel/test-dns-default-order-verbatim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());

0 comments on commit 6b90982

Please sign in to comment.