@@ -473,6 +473,8 @@ t.test('miscellaneous headers', t => {
473473 t . strictSame ( ua , [ 'agent of use' ] , 'UA set from options' ) )
474474 . matchHeader ( 'npm-command' , cmd =>
475475 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' ) )
476478 . get ( '/hello' )
477479 . reply ( 200 , { hello : 'world' } )
478480
@@ -483,6 +485,22 @@ t.test('miscellaneous headers', t => {
483485 scope : '@foo' ,
484486 userAgent : 'agent of use' ,
485487 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 ,
486504 } ) . then ( res => {
487505 t . equal ( res . status , 200 , 'got successful response' )
488506 } )
0 commit comments