File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ function headersGetter(headers) {
63
63
if ( ! headersObj ) headersObj = parseHeaders ( headers ) ;
64
64
65
65
if ( name ) {
66
- return headersObj [ lowercase ( name ) ] || null ;
66
+ name = lowercase ( name ) ;
67
+ return headersObj . hasOwnProperty ( name ) ? headersObj [ name ] : null ;
67
68
}
68
69
69
70
return headersObj ;
Original file line number Diff line number Diff line change @@ -816,6 +816,15 @@ describe('$http', function() {
816
816
} ) ;
817
817
818
818
819
+ it ( 'should handle empty response header' , function ( ) {
820
+ $httpBackend . expect ( 'GET' , '/url' , undefined )
821
+ . respond ( 200 , '' , { 'Custom-Empty-Response-Header' : '' } ) ;
822
+ $http . get ( '/url' ) . success ( callback ) ;
823
+ $httpBackend . flush ( ) ;
824
+ expect ( callback ) . toHaveBeenCalledOnce ( ) ;
825
+ expect ( callback . mostRecentCall . args [ 2 ] ( 'custom-empty-response-Header' ) ) . toBe ( '' ) ;
826
+ } ) ;
827
+
819
828
it ( 'should have delete()' , function ( ) {
820
829
$httpBackend . expect ( 'DELETE' , '/url' ) . respond ( '' ) ;
821
830
$http [ 'delete' ] ( '/url' ) ;
You can’t perform that action at this time.
0 commit comments