Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c67085

Browse filesBrowse files
VoltrexKeyvaBethGriggs
authored andcommitted
dns: cleanup validation
The `validateString()` validator should cleanup the validation and keep consistency. PR-URL: #40061 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7fdb127 commit 5c67085
Copy full SHA for 5c67085

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/dns/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/dns/utils.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const IPv6RE = /^\[([^[\]]*)\]/;
3232
const addrSplitRE = /(^.+?)(?::(\d+))?$/;
3333
const {
3434
ERR_DNS_SET_SERVERS_FAILED,
35-
ERR_INVALID_ARG_TYPE,
3635
ERR_INVALID_ARG_VALUE,
3736
ERR_INVALID_IP_ADDRESS,
3837
} = errors.codes;
@@ -131,8 +130,8 @@ class Resolver {
131130
setLocalAddress(ipv4, ipv6) {
132131
validateString(ipv4, 'ipv4');
133132

134-
if (typeof ipv6 !== 'string' && ipv6 !== undefined) {
135-
throw new ERR_INVALID_ARG_TYPE('ipv6', ['String', 'undefined'], ipv6);
133+
if (ipv6 !== undefined) {
134+
validateString(ipv6, 'ipv6');
136135
}
137136

138137
this._handle.setLocalAddress(ipv4, ipv6);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.