MCPcopy Create free account
hub / github.com/angular-ui/ui-router / wrapResponse

Function wrapResponse

test/angular/1.2/angular-mocks.js:1124–1145  ·  view source on GitHub ↗
(wrapped)

Source from the content-addressed store, hash-verified

1122 }
1123
1124 function wrapResponse(wrapped) {
1125 if (!$browser && timeout && timeout.then) timeout.then(handleTimeout);
1126
1127 return handleResponse;
1128
1129 function handleResponse() {
1130 var response = wrapped.response(method, url, data, headers);
1131 xhr.$$respHeaders = response[2];
1132 callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
1133 copy(response[3] || ''));
1134 }
1135
1136 function handleTimeout() {
1137 for (var i = 0, ii = responses.length; i < ii; i++) {
1138 if (responses[i] === handleResponse) {
1139 responses.splice(i, 1);
1140 callback(-1, undefined, '');
1141 break;
1142 }
1143 }
1144 }
1145 }
1146
1147 if (expectation && expectation.match(method, url)) {
1148 if (!expectation.matchData(data))

Callers 1

$httpBackendFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected