@@ -473,6 +473,8 @@ t.test('miscellaneous headers', t => {
473
473
t . strictSame ( ua , [ 'agent of use' ] , 'UA set from options' ) )
474
474
. matchHeader ( 'npm-command' , cmd =>
475
475
t . strictSame ( cmd , [ 'hello-world' ] , 'command set from options' ) )
476
+ . matchHeader ( 'npm-auth-type' , authType =>
477
+ t . strictSame ( authType , [ 'auth' ] , 'auth-type set from options' ) )
476
478
. get ( '/hello' )
477
479
. reply ( 200 , { hello : 'world' } )
478
480
@@ -483,6 +485,22 @@ t.test('miscellaneous headers', t => {
483
485
scope : '@foo' ,
484
486
userAgent : 'agent of use' ,
485
487
npmCommand : 'hello-world' ,
488
+ authType : 'auth' ,
489
+ } ) . then ( res => {
490
+ t . equal ( res . status , 200 , 'got successful response' )
491
+ } )
492
+ } )
493
+
494
+ t . test ( 'miscellaneous headers not being set if not present in options' , t => {
495
+ tnock ( t , defaultOpts . registry )
496
+ . matchHeader ( 'npm-auth-type' , authType =>
497
+ t . strictSame ( authType , undefined , 'auth-type not set from options' ) )
498
+ . get ( '/hello' )
499
+ . reply ( 200 , { hello : 'world' } )
500
+
501
+ return fetch ( '/hello' , {
502
+ ...OPTS ,
503
+ authType : undefined ,
486
504
} ) . then ( res => {
487
505
t . equal ( res . status , 200 , 'got successful response' )
488
506
} )
0 commit comments