Skip to content

Commit 5c67085

Browse 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

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎lib/internal/dns/utils.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const IPv6RE = /^\[([^[\]]*)\]/;
3232
constaddrSplitRE=/(^.+?)(?::(\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(typeofipv6!=='string'&&ipv6!==undefined){
135-
thrownewERR_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)