@@ -333,7 +333,7 @@ function getDeprecatedPrefersHttp2(opts: DataAPIClientOptions | undefined | null
333
333
}
334
334
335
335
function validateRootOpts ( opts : DataAPIClientOptions | undefined | null ) {
336
- validateOption ( 'root client options ' , opts , 'object' ) ;
336
+ validateOption ( 'DataAPIClientOptions ' , opts , 'object' ) ;
337
337
338
338
if ( ! opts ) {
339
339
return ;
@@ -348,32 +348,32 @@ function validateRootOpts(opts: DataAPIClientOptions | undefined | null) {
348
348
}
349
349
350
350
function validateHttpOpts ( opts : DataAPIHttpOptions | undefined | null ) {
351
- validateOption ( 'http options ' , opts , 'object' ) ;
351
+ validateOption ( 'httpOptions ' , opts , 'object' ) ;
352
352
353
353
if ( ! opts ) {
354
354
return ;
355
355
}
356
356
357
- validateOption ( 'client option ' , opts . client , 'string' , false , ( client ) => {
357
+ validateOption ( 'httpOptions. client' , opts . client , 'string' , false , ( client ) => {
358
358
if ( client !== 'fetch' && client !== 'default' && client !== 'custom' ) {
359
- throw new Error ( 'Invalid httpOptions.client; expected \'fetch\' or \'default\'' ) ;
359
+ throw new Error ( 'Invalid httpOptions.client; expected \'fetch\', \'default\', \'custom\', or undefined ' ) ;
360
360
}
361
361
} ) ;
362
- validateOption ( 'maxTimeMS option ' , opts . maxTimeMS , 'number' ) ;
362
+ validateOption ( 'httpOptions. maxTimeMS' , opts . maxTimeMS , 'number' ) ;
363
363
364
364
if ( opts . client === 'default' || opts . client === undefined ) {
365
- validateOption ( 'preferHttp2 option ' , opts . preferHttp2 , 'boolean' ) ;
365
+ validateOption ( 'httpOptions. preferHttp2' , opts . preferHttp2 , 'boolean' ) ;
366
366
367
- validateOption ( 'http1 options' , opts . http1 , 'object' , false , ( http1 ) => {
368
- validateOption ( 'http1.keepAlive option ' , http1 . keepAlive , 'boolean' ) ;
369
- validateOption ( 'http1.keepAliveMS option ' , http1 . keepAliveMS , 'number' ) ;
370
- validateOption ( 'http1.maxSockets option ' , http1 . maxSockets , 'number' ) ;
371
- validateOption ( 'http1.maxFreeSockets option ' , http1 . maxFreeSockets , 'number' ) ;
367
+ validateOption ( 'httpOptions. http1 options' , opts . http1 , 'object' , false , ( http1 ) => {
368
+ validateOption ( 'http1.keepAlive' , http1 . keepAlive , 'boolean' ) ;
369
+ validateOption ( 'http1.keepAliveMS' , http1 . keepAliveMS , 'number' ) ;
370
+ validateOption ( 'http1.maxSockets' , http1 . maxSockets , 'number' ) ;
371
+ validateOption ( 'http1.maxFreeSockets' , http1 . maxFreeSockets , 'number' ) ;
372
372
} ) ;
373
373
}
374
374
375
375
if ( opts . client === 'custom' ) {
376
- validateOption ( 'fetcher option' , opts . fetcher , 'object' , true , ( fetcher ) => {
376
+ validateOption ( 'httpOptions. fetcher option' , opts . fetcher , 'object' , true , ( fetcher ) => {
377
377
validateOption ( 'fetcher.fetch option' , fetcher . fetch , 'function' , true ) ;
378
378
validateOption ( 'fetcher.close option' , fetcher . close , 'function' ) ;
379
379
} ) ;
0 commit comments