@@ -619,7 +619,26 @@ describe('fetch', () => {
619619 'https://third-party.com/private-resource' ,
620620 {
621621 headers : {
622- entries : ( ) => [ [ 'accept' , 'text/plain' ] ] ,
622+ forEach : ( iterate ) => iterate ( 'text/plain' , 'accept' ) ,
623+ } ,
624+ }
625+ )
626+ expect ( resp . status ) . toBe ( 200 )
627+ } )
628+
629+ it ( 'accepts a Headers object when no authentication is needed' , async ( ) => {
630+ await saveSession ( window . localStorage ) ( fakeSession )
631+
632+ nock ( 'https://third-party.com' )
633+ . get ( '/public-resource' )
634+ . matchHeader ( 'accept' , 'text/plain' )
635+ . reply ( 200 )
636+
637+ const resp = await instance . fetch (
638+ 'https://third-party.com/public-resource' ,
639+ {
640+ headers : {
641+ forEach : ( iterate ) => iterate ( 'text/plain' , 'accept' ) ,
623642 } ,
624643 }
625644 )
@@ -642,7 +661,7 @@ describe('fetch', () => {
642661 const resp = await instance . fetch ( {
643662 url : 'https://third-party.com/private-resource' ,
644663 headers : {
645- entries : ( ) => [ [ 'accept ', 'text/plain' ] ] ,
664+ forEach : ( iterate ) => iterate ( 'text/plain ', 'accept' ) ,
646665 } ,
647666 } )
648667 expect ( resp . status ) . toBe ( 200 )
0 commit comments