-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.
Description
- Node.js Version: 12.2
- OS: macOs
- Scope (install, code, runtime, meta, other?): runtime
- Module (and version) (if relevant):
dns
,net
,tls
Quick question: is dns.lookup(url, 0, callback)
supported as part of Node's API? The documentation says Must be 4 or 6
, and any positive integer other than 4 or 6 will return a TypeError [ERR_INVALID_OPT_VALUE]: The value "2" is invalid for option "family"
. But passing in 0
does not error. Is this expected? If so, is this something stable that developers can rely on?
// The following are all expected to work
dns.lookup('www.google.com', 4, err => {
console.log(err); // null
});
dns.lookup('www.google.com', 6, err => {
console.log(err); // null
});
dns.lookup('www.google.com', err => {
console.log(err); // null
});
// The following should error
try {
dns.lookup('www.google.com', 1, () => {});
} catch (e) {
console.log(e); // TypeError [ERR_INVALID_OPT_VALUE]: The value "1" is invalid for option "family"
}
try {
dns.lookup('www.google.com', 2, () => {});
} catch (e) {
console.log(e); // TypeError [ERR_INVALID_OPT_VALUE]: The value "2" is invalid for option "family"
}
try {
dns.lookup('www.google.com', 3, () => {});
} catch (e) {
console.log(e); // TypeError [ERR_INVALID_OPT_VALUE]: The value "3" is invalid for option "family"
}
try {
dns.lookup('www.google.com', 5, () => {});
} catch (e) {
console.log(e); // TypeError [ERR_INVALID_OPT_VALUE]: The value "5" is invalid for option "family"
}
// Asking about this one:
dns.lookup('www.google.com', 0, err => {
console.log(err); // null <-- is this correct?
});
Metadata
Metadata
Assignees
Labels
dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.