dns: update lookupService() first arg name · nodejs/node@6f7b561 · GitHub
Skip to content

Commit 6f7b561

Browse files
cjihrigtargos
authored andcommitted
dns: update lookupService() first arg name
The first argument to lookupService() should be an IP address, and is named "address" in the documentation. This commit updates the code to match the documentation and provide less confusing errors. PR-URL: #29040 Fixes: #29039 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e3b1243 commit 6f7b561

3 files changed

Lines changed: 18 additions & 19 deletions

File tree

lib/dns.js

Lines changed: 7 additions & 8 deletions

lib/internal/dns/promises.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,17 @@ function createLookupServicePromise(hostname, port) {
151151
});
152152
}
153153

154-
function lookupService(hostname, port) {
154+
function lookupService(address, port) {
155155
if (arguments.length !== 2)
156-
throw new ERR_MISSING_ARGS('hostname', 'port');
156+
throw new ERR_MISSING_ARGS('address', 'port');
157157

158-
if (isIP(hostname) === 0)
159-
throw new ERR_INVALID_OPT_VALUE('hostname', hostname);
158+
if (isIP(address) === 0)
159+
throw new ERR_INVALID_OPT_VALUE('address', address);
160160

161161
if (!isLegalPort(port))
162162
throw new ERR_SOCKET_BAD_PORT(port);
163163

164-
return createLookupServicePromise(hostname, +port);
164+
return createLookupServicePromise(address, +port);
165165
}
166166

167167

test/parallel/test-dns.js

Lines changed: 6 additions & 6 deletions

0 commit comments

Comments
 (0)