@@ -84,9 +84,10 @@ const {
84
84
getAllowUnauthorized,
85
85
} = require ( 'internal/options' ) ;
86
86
const {
87
+ validateBuffer,
87
88
validateCallback,
89
+ validateObject,
88
90
validateString,
89
- validateBuffer,
90
91
validateUint32
91
92
} = require ( 'internal/validators' ) ;
92
93
const traceTls = getOptionValue ( '--trace-tls' ) ;
@@ -364,8 +365,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
364
365
if ( ret == null )
365
366
return undefined ;
366
367
367
- if ( typeof ret !== 'object' )
368
- throw new ERR_INVALID_ARG_TYPE ( 'ret' , 'Object' , ret ) ;
368
+ validateObject ( ret , 'ret' ) ;
369
369
370
370
validateBuffer ( ret . psk , 'psk' ) ;
371
371
if ( ret . psk . length > maxPskLen ) {
@@ -823,8 +823,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
823
823
} ;
824
824
825
825
TLSSocket . prototype . renegotiate = function ( options , callback ) {
826
- if ( options === null || typeof options !== 'object' )
827
- throw new ERR_INVALID_ARG_TYPE ( 'options' , 'Object' , options ) ;
826
+ validateObject ( options , 'options' ) ;
828
827
if ( callback !== undefined ) {
829
828
validateCallback ( callback ) ;
830
829
}
@@ -1237,8 +1236,7 @@ exports.createServer = function createServer(options, listener) {
1237
1236
1238
1237
1239
1238
Server . prototype . setSecureContext = function ( options ) {
1240
- if ( options === null || typeof options !== 'object' )
1241
- throw new ERR_INVALID_ARG_TYPE ( 'options' , 'Object' , options ) ;
1239
+ validateObject ( options , 'options' ) ;
1242
1240
1243
1241
if ( options . pfx )
1244
1242
this . pfx = options . pfx ;
0 commit comments