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

Function wrapResponse

lib/test/angular/1.6.7/angular-mocks.js:1385–1413  ·  view source on GitHub ↗
(wrapped)

Source from the content-addressed store, hash-verified

1383 }
1384
1385 function wrapResponse(wrapped) {
1386 if (!$browser && timeout) {
1387 if (timeout.then) {
1388 timeout.then(handleTimeout);
1389 } else {
1390 $timeout(handleTimeout, timeout);
1391 }
1392 }
1393
1394 handleResponse.description = method + ' ' + url;
1395 return handleResponse;
1396
1397 function handleResponse() {
1398 var response = wrapped.response(method, url, data, headers, wrapped.params(url));
1399 xhr.$$respHeaders = response[2];
1400 callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
1401 copy(response[3] || ''), copy(response[4]));
1402 }
1403
1404 function handleTimeout() {
1405 for (var i = 0, ii = responses.length; i < ii; i++) {
1406 if (responses[i] === handleResponse) {
1407 responses.splice(i, 1);
1408 callback(-1, undefined, '', undefined, 'timeout');
1409 break;
1410 }
1411 }
1412 }
1413 }
1414
1415 if (expectation && expectation.match(method, url)) {
1416 if (!expectation.matchData(data)) {

Callers 1

$httpBackendFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected