@@ -933,12 +933,13 @@ describe('$http', function() {
933
933
it ( 'should handle empty response header' , function ( ) {
934
934
$httpBackend . expect ( 'GET' , '/url' , undefined )
935
935
. respond ( 200 , '' , { 'Custom-Empty-Response-Header' : '' , 'Constructor' : '' } ) ;
936
- $http . get ( '/url' ) . success ( callback ) ;
936
+ $http . get ( '/url' ) . then ( callback ) ;
937
937
$httpBackend . flush ( ) ;
938
938
expect ( callback ) . toHaveBeenCalledOnce ( ) ;
939
- expect ( callback . mostRecentCall . args [ 2 ] ( 'custom-empty-response-Header' ) ) . toBe ( '' ) ;
940
- expect ( callback . mostRecentCall . args [ 2 ] ( 'ToString' ) ) . toBe ( null ) ;
941
- expect ( callback . mostRecentCall . args [ 2 ] ( 'Constructor' ) ) . toBe ( '' ) ;
939
+ var headers = callback . mostRecentCall . args [ 0 ] . headers ;
940
+ expect ( headers ( 'custom-empty-response-Header' ) ) . toEqual ( '' ) ;
941
+ expect ( headers ( 'ToString' ) ) . toBe ( null ) ;
942
+ expect ( headers ( 'Constructor' ) ) . toBe ( '' ) ;
942
943
} ) ;
943
944
944
945
it ( 'should have delete()' , function ( ) {
@@ -1731,12 +1732,12 @@ describe('$http', function() {
1731
1732
1732
1733
$httpBackend . expect ( 'GET' , '/some' ) . respond ( 200 ) ;
1733
1734
1734
- $http ( { method : 'GET' , url : '/some' , timeout : canceler . promise } ) . error (
1735
- function ( data , status , headers , config ) {
1736
- expect ( data ) . toBeUndefined ( ) ;
1737
- expect ( status ) . toBe ( - 1 ) ;
1738
- expect ( headers ( ) ) . toEqual ( { } ) ;
1739
- expect ( config . url ) . toBe ( '/some' ) ;
1735
+ $http ( { method : 'GET' , url : '/some' , timeout : canceler . promise } ) . catch (
1736
+ function ( response ) {
1737
+ expect ( response . data ) . toBeUndefined ( ) ;
1738
+ expect ( response . status ) . toBe ( - 1 ) ;
1739
+ expect ( response . headers ( ) ) . toEqual ( { } ) ;
1740
+ expect ( response . config . url ) . toBe ( '/some' ) ;
1740
1741
callback ( ) ;
1741
1742
} ) ;
1742
1743
0 commit comments