@@ -126,7 +126,8 @@ const {
126126 validateNumber,
127127 validateString,
128128 validateUint32,
129- validateAbortSignal
129+ validateAbortSignal,
130+ validateBoolean,
130131} = require ( 'internal/validators' ) ;
131132const fsPromisesInternal = require ( 'internal/fs/promises' ) ;
132133const { utcDate } = require ( 'internal/http' ) ;
@@ -761,26 +762,26 @@ function requestOnConnect(headers, options) {
761762const setAndValidatePriorityOptions = hideStackFrames ( ( options ) => {
762763 if ( options . weight === undefined ) {
763764 options . weight = NGHTTP2_DEFAULT_WEIGHT ;
764- } else if ( typeof options . weight !== 'number' ) {
765- throw new ERR_INVALID_ARG_VALUE ( ' options.weight' , options . weight ) ;
765+ } else {
766+ validateNumber ( options . weight , ' options.weight' ) ;
766767 }
767768
768769 if ( options . parent === undefined ) {
769770 options . parent = 0 ;
770- } else if ( typeof options . parent !== 'number' || options . parent < 0 ) {
771- throw new ERR_INVALID_ARG_VALUE ( ' options.parent' , options . parent ) ;
771+ } else {
772+ validateNumber ( options . parent , ' options.parent' , 0 ) ;
772773 }
773774
774775 if ( options . exclusive === undefined ) {
775776 options . exclusive = false ;
776- } else if ( typeof options . exclusive !== 'boolean' ) {
777- throw new ERR_INVALID_ARG_VALUE ( ' options.exclusive' , options . exclusive ) ;
777+ } else {
778+ validateBoolean ( options . exclusive , ' options.exclusive' ) ;
778779 }
779780
780781 if ( options . silent === undefined ) {
781782 options . silent = false ;
782- } else if ( typeof options . silent !== 'boolean' ) {
783- throw new ERR_INVALID_ARG_VALUE ( ' options.silent' , options . silent ) ;
783+ } else {
784+ validateBoolean ( options . silent , ' options.silent' ) ;
784785 }
785786} ) ;
786787
@@ -1784,8 +1785,8 @@ class ClientHttp2Session extends Http2Session {
17841785 // stream by default if the user has not specifically indicated a
17851786 // preference.
17861787 options . endStream = isPayloadMeaningless ( headers [ HTTP2_HEADER_METHOD ] ) ;
1787- } else if ( typeof options . endStream !== 'boolean' ) {
1788- throw new ERR_INVALID_ARG_VALUE ( ' options.endStream' , options . endStream ) ;
1788+ } else {
1789+ validateBoolean ( options . endStream , ' options.endStream' ) ;
17891790 }
17901791
17911792 const headersList = mapToHeaders ( headers ) ;
0 commit comments