@@ -90,7 +90,7 @@ describe('$httpBackend', function() {
90
90
} ) ;
91
91
92
92
it ( 'should call completion function with xhr.statusText if present' , function ( ) {
93
- callback . and . callFake ( function ( status , response , headers , statusText ) {
93
+ callback . and . callFake ( function ( status , response , headers , statusText , xhrStatus ) {
94
94
expect ( statusText ) . toBe ( 'OK' ) ;
95
95
} ) ;
96
96
@@ -102,7 +102,7 @@ describe('$httpBackend', function() {
102
102
} ) ;
103
103
104
104
it ( 'should call completion function with empty string if not present' , function ( ) {
105
- callback . and . callFake ( function ( status , response , headers , statusText ) {
105
+ callback . and . callFake ( function ( status , response , headers , statusText , xhrStatus ) {
106
106
expect ( statusText ) . toBe ( '' ) ;
107
107
} ) ;
108
108
@@ -155,11 +155,12 @@ describe('$httpBackend', function() {
155
155
} ) ;
156
156
157
157
it ( 'should not try to read response data when request is aborted' , function ( ) {
158
- callback . and . callFake ( function ( status , response , headers , statusText ) {
158
+ callback . and . callFake ( function ( status , response , headers , statusText , xhrStatus ) {
159
159
expect ( status ) . toBe ( - 1 ) ;
160
160
expect ( response ) . toBe ( null ) ;
161
161
expect ( headers ) . toBe ( null ) ;
162
162
expect ( statusText ) . toBe ( '' ) ;
163
+ expect ( xhrStatus ) . toBe ( 'Request Aborted' ) ;
163
164
} ) ;
164
165
$backend ( 'GET' , '/url' , null , callback , { } , 2000 ) ;
165
166
xhr = MockXhr . $$lastInstance ;
@@ -174,11 +175,12 @@ describe('$httpBackend', function() {
174
175
} ) ;
175
176
176
177
it ( 'should complete the request on timeout' , function ( ) {
177
- callback . and . callFake ( function ( status , response , headers , statusText ) {
178
+ callback . and . callFake ( function ( status , response , headers , statusText , xhrStatus ) {
178
179
expect ( status ) . toBe ( - 1 ) ;
179
180
expect ( response ) . toBe ( null ) ;
180
181
expect ( headers ) . toBe ( null ) ;
181
182
expect ( statusText ) . toBe ( '' ) ;
183
+ expect ( xhrStatus ) . toBe ( 'Request Timed Out' ) ;
182
184
} ) ;
183
185
$backend ( 'GET' , '/url' , null , callback , { } ) ;
184
186
xhr = MockXhr . $$lastInstance ;
@@ -511,4 +513,3 @@ describe('$httpBackend', function() {
511
513
} ) ;
512
514
} ) ;
513
515
} ) ;
514
-
0 commit comments