Skip to content

Commit

Permalink
dns: honor the order option
Browse files Browse the repository at this point in the history
Fixes: #55391
PR-URL: #55392
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Feng Yu <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
  • Loading branch information
lpinca authored and ruyadorno committed Nov 27, 2024
1 parent 8daa8a6 commit ef6707e
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 ef6707e

Please sign in to comment.