Skip to content

Commit ef6707e

Browse files
lpincaruyadorno
authored andcommitted
dns: honor the order option
Fixes: #55391 PR-URL: #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>
1 parent 8daa8a6 commit ef6707e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/dns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function lookup(hostname, options, callback) {
193193
}
194194
if (options?.order != null) {
195195
validateOneOf(options.order, 'options.order', ['ipv4first', 'ipv6first', 'verbatim']);
196-
dnsOrder = options.dnsOrder;
196+
dnsOrder = options.order;
197197
}
198198
}
199199

test/parallel/test-dns-default-order-verbatim.js

+10
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,14 @@ function allowFailed(fn) {
4646

4747
await allowFailed(dnsPromises.lookup('example.org', {}));
4848
checkParameter(cares.DNS_ORDER_VERBATIM);
49+
50+
await allowFailed(
51+
promisify(dns.lookup)('example.org', { order: 'ipv4first' })
52+
);
53+
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
54+
55+
await allowFailed(
56+
promisify(dns.lookup)('example.org', { order: 'ipv6first' })
57+
);
58+
checkParameter(cares.DNS_ORDER_IPV6_FIRST);
4959
})().then(common.mustCall());

0 commit comments

Comments
 (0)