Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 43ed2b7

Browse files
tipycalFlowNarretz
authored andcommitted
Adding param xhrStatus to response
1 parent 3c259ce commit 43ed2b7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/ng/http.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1268,9 +1268,9 @@ function $HttpProvider() {
12681268
} else {
12691269
// serving from cache
12701270
if (isArray(cachedResp)) {
1271-
resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
1271+
resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3], cachedResp[4]);
12721272
} else {
1273-
resolvePromise(cachedResp, 200, {}, 'OK');
1273+
resolvePromise(cachedResp, 200, {}, 'OK', 'Request Completed');
12741274
}
12751275
}
12761276
} else {
@@ -1327,18 +1327,18 @@ function $HttpProvider() {
13271327
* - resolves the raw $http promise
13281328
* - calls $apply
13291329
*/
1330-
function done(status, response, headersString, statusText) {
1330+
function done(status, response, headersString, statusText, xhrStatus) {
13311331
if (cache) {
13321332
if (isSuccess(status)) {
1333-
cache.put(url, [status, response, parseHeaders(headersString), statusText]);
1333+
cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]);
13341334
} else {
13351335
// remove promise from the cache
13361336
cache.remove(url);
13371337
}
13381338
}
13391339

13401340
function resolveHttpPromise() {
1341-
resolvePromise(response, status, headersString, statusText);
1341+
resolvePromise(response, status, headersString, statusText, xhrStatus);
13421342
}
13431343

13441344
if (useApplyAsync) {
@@ -1353,7 +1353,7 @@ function $HttpProvider() {
13531353
/**
13541354
* Resolves the raw $http promise.
13551355
*/
1356-
function resolvePromise(response, status, headers, statusText) {
1356+
function resolvePromise(response, status, headers, statusText, xhrStatus) {
13571357
//status: HTTP response status code, 0, -1 (aborted by timeout / promise)
13581358
status = status >= -1 ? status : 0;
13591359

@@ -1362,12 +1362,13 @@ function $HttpProvider() {
13621362
status: status,
13631363
headers: headersGetter(headers),
13641364
config: config,
1365-
statusText: statusText
1365+
statusText: statusText,
1366+
xhrStatus: xhrStatus
13661367
});
13671368
}
13681369

13691370
function resolvePromiseWithResult(result) {
1370-
resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
1371+
resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText, result.xhrStatus);
13711372
}
13721373

13731374
function removePendingReq() {

0 commit comments

Comments
 (0)