diff --git a/lib/dns.js b/lib/dns.js index 219934f00d8..a2564b903b4 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -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; } } diff --git a/test/parallel/test-dns-default-order-verbatim.js b/test/parallel/test-dns-default-order-verbatim.js index 0c45728782d..12b666191b9 100644 --- a/test/parallel/test-dns-default-order-verbatim.js +++ b/test/parallel/test-dns-default-order-verbatim.js @@ -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());