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

Function wrapResponse

lib/test/angular/1.5.0/angular-mocks.js:1342–1365  ·  view source on GitHub ↗
(wrapped)

Source from the content-addressed store, hash-verified

1340 }
1341
1342 function wrapResponse(wrapped) {
1343 if (!$browser && timeout) {
1344 timeout.then ? timeout.then(handleTimeout) : $timeout(handleTimeout, timeout);
1345 }
1346
1347 return handleResponse;
1348
1349 function handleResponse() {
1350 var response = wrapped.response(method, url, data, headers, wrapped.params(url));
1351 xhr.$$respHeaders = response[2];
1352 callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
1353 copy(response[3] || ''));
1354 }
1355
1356 function handleTimeout() {
1357 for (var i = 0, ii = responses.length; i < ii; i++) {
1358 if (responses[i] === handleResponse) {
1359 responses.splice(i, 1);
1360 callback(-1, undefined, '');
1361 break;
1362 }
1363 }
1364 }
1365 }
1366
1367 if (expectation && expectation.match(method, url)) {
1368 if (!expectation.matchData(data)) {

Callers 1

$httpBackendFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected