@@ -606,7 +606,7 @@ describe('fetch', () => {
606606 expect ( resp . status ) . toBe ( 200 )
607607 } )
608608
609- it ( 'merges a Header object with the authorization header' , async ( ) => {
609+ it ( 'merges a Headers object with the authorization header' , async ( ) => {
610610 await saveSession ( window . localStorage ) ( fakeSession )
611611
612612 nock ( 'https://third-party.com' )
@@ -628,6 +628,28 @@ describe('fetch', () => {
628628 expect ( resp . status ) . toBe ( 200 )
629629 } )
630630
631+ // skipped because isomorphic-fetch does not support Request as first parameter;
632+ // it works in the browser
633+ it . skip ( 'merges headers in a Request object with the authorization header' , async ( ) => {
634+ await saveSession ( window . localStorage ) ( fakeSession )
635+
636+ nock ( 'https://third-party.com' )
637+ . get ( '/private-resource' )
638+ . reply ( 401 , '' , { 'www-authenticate' : 'Bearer scope="openid webid"' } )
639+ . get ( '/private-resource' )
640+ . matchHeader ( 'accept' , 'text/plain' )
641+ . matchHeader ( 'authorization' , matchAuthzHeader ( 'https://third-party.com' ) )
642+ . reply ( 200 )
643+
644+ const resp = await instance . fetch ( {
645+ url : 'https://third-party.com/private-resource' ,
646+ headers : {
647+ entries : ( ) => [ [ 'accept' , 'text/plain' ] ]
648+ }
649+ } )
650+ expect ( resp . status ) . toBe ( 200 )
651+ } )
652+
631653 it ( 'does not resend with credentials if the www-authenticate header is missing' , async ( ) => {
632654 expect . assertions ( 1 )
633655 await saveSession ( window . localStorage ) ( fakeSession )
0 commit comments