@@ -470,6 +470,30 @@ describe('mocks', function() {
470470 } ) ;
471471
472472
473+ it ( 'should normalize when header name case when accessed via getResponseHeader' , function ( ) {
474+ hb . when ( 'GET' , '/u1' ) . respond ( 200 , null , { 'X-Fake' : 'Header' ,
475+ 'Content-Type' : 'application/json' ,
476+ 'Location' : '/foo' } ) ;
477+ var xhr = hb ( 'GET' , '/u1' , null , noop , { } ) ;
478+ hb . flush ( ) ;
479+ expect ( xhr . getResponseHeader ( 'x-fAKE' ) ) . toBe ( 'Header' ) ;
480+ expect ( xhr . getResponseHeader ( 'content-type' ) ) . toBe ( 'application/json' ) ;
481+ expect ( xhr . getResponseHeader ( 'Location' ) ) . toBe ( '/foo' ) ;
482+ } ) ;
483+
484+
485+ it ( 'should normalize expect header name case when accessed via getResponseHeader' , function ( ) {
486+ hb . expect ( 'GET' , '/u1' ) . respond ( 200 , null , { 'X-Fake' : 'Header' ,
487+ 'Content-Type' : 'application/json' ,
488+ 'Location' : '/foo' } ) ;
489+ var xhr = hb ( 'GET' , '/u1' , null , noop , { } ) ;
490+ hb . flush ( ) ;
491+ expect ( xhr . getResponseHeader ( 'x-fAKE' ) ) . toBe ( 'Header' ) ;
492+ expect ( xhr . getResponseHeader ( 'content-type' ) ) . toBe ( 'application/json' ) ;
493+ expect ( xhr . getResponseHeader ( 'Location' ) ) . toBe ( '/foo' ) ;
494+ } ) ;
495+
496+
473497 it ( 'should preserve the order of requests' , function ( ) {
474498 hb . when ( 'GET' , '/url1' ) . respond ( 200 , 'first' ) ;
475499 hb . when ( 'GET' , '/url2' ) . respond ( 201 , 'second' ) ;
0 commit comments