@@ -1090,12 +1090,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1090
1090
responsesPush = angular . bind ( responses , responses . push ) ,
1091
1091
copy = angular . copy ;
1092
1092
1093
- function createResponse ( status , data , headers ) {
1093
+ function createResponse ( status , data , headers , statusText ) {
1094
1094
if ( angular . isFunction ( status ) ) return status ;
1095
1095
1096
1096
return function ( ) {
1097
1097
return angular . isNumber ( status )
1098
- ? [ status , data , headers ]
1098
+ ? [ status , data , headers , statusText ]
1099
1099
: [ 200 , status , data ] ;
1100
1100
} ;
1101
1101
}
@@ -1120,7 +1120,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1120
1120
function handleResponse ( ) {
1121
1121
var response = wrapped . response ( method , url , data , headers ) ;
1122
1122
xhr . $$respHeaders = response [ 2 ] ;
1123
- callback ( copy ( response [ 0 ] ) , copy ( response [ 1 ] ) , xhr . getAllResponseHeaders ( ) ) ;
1123
+ callback ( copy ( response [ 0 ] ) , copy ( response [ 1 ] ) , xhr . getAllResponseHeaders ( ) ,
1124
+ copy ( response [ 3 ] || '' ) ) ;
1124
1125
}
1125
1126
1126
1127
function handleTimeout ( ) {
@@ -1188,16 +1189,17 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1188
1189
* request is handled.
1189
1190
*
1190
1191
* - respond –
1191
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1192
- * – The respond method takes a set of static data to be returned or a function that can return
1193
- * an array containing response status (number), response data (string) and response headers
1194
- * (Object).
1192
+ * `{function([status,] data[, headers, statusText])
1193
+ * | function(function(method, url, data, headers)}`
1194
+ * – The respond method takes a set of static data to be returned or a function that can
1195
+ * return an array containing response status (number), response data (string), response
1196
+ * headers (Object), and the text for the status (string).
1195
1197
*/
1196
1198
$httpBackend . when = function ( method , url , data , headers ) {
1197
1199
var definition = new MockHttpExpectation ( method , url , data , headers ) ,
1198
1200
chain = {
1199
- respond : function ( status , data , headers ) {
1200
- definition . response = createResponse ( status , data , headers ) ;
1201
+ respond : function ( status , data , headers , statusText ) {
1202
+ definition . response = createResponse ( status , data , headers , statusText ) ;
1201
1203
}
1202
1204
} ;
1203
1205
@@ -1312,17 +1314,18 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1312
1314
* request is handled.
1313
1315
*
1314
1316
* - respond –
1315
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1316
- * – The respond method takes a set of static data to be returned or a function that can return
1317
- * an array containing response status (number), response data (string) and response headers
1318
- * (Object).
1317
+ * `{function([status,] data[, headers, statusText])
1318
+ * | function(function(method, url, data, headers)}`
1319
+ * – The respond method takes a set of static data to be returned or a function that can
1320
+ * return an array containing response status (number), response data (string), response
1321
+ * headers (Object), and the text for the status (string).
1319
1322
*/
1320
1323
$httpBackend . expect = function ( method , url , data , headers ) {
1321
1324
var expectation = new MockHttpExpectation ( method , url , data , headers ) ;
1322
1325
expectations . push ( expectation ) ;
1323
1326
return {
1324
- respond : function ( status , data , headers ) {
1325
- expectation . response = createResponse ( status , data , headers ) ;
1327
+ respond : function ( status , data , headers , statusText ) {
1328
+ expectation . response = createResponse ( status , data , headers , statusText ) ;
1326
1329
}
1327
1330
} ;
1328
1331
} ;
@@ -1833,13 +1836,14 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1833
1836
* control how a matched request is handled.
1834
1837
*
1835
1838
* - respond –
1836
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1839
+ * `{function([status,] data[, headers, statusText])
1840
+ * | function(function(method, url, data, headers)}`
1837
1841
* – The respond method takes a set of static data to be returned or a function that can return
1838
- * an array containing response status (number), response data (string) and response headers
1839
- * (Object).
1840
- * - passThrough – `{function()}` – Any request matching a backend definition with `passThrough`
1841
- * handler will be passed through to the real backend (an XHR request will be made to the
1842
- * server.)
1842
+ * an array containing response status (number), response data (string), response headers
1843
+ * (Object), and the text for the status (string) .
1844
+ * - passThrough – `{function()}` – Any request matching a backend definition with
1845
+ * `passThrough` handler will be passed through to the real backend (an XHR request will be made
1846
+ * to the server.)
1843
1847
*/
1844
1848
1845
1849
/**
0 commit comments