MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / wrapResponse

Function wrapResponse

lib/test/angular/1.7.0/angular-mocks.js:1385–1417  ·  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(function() {
1389 handlePrematureEnd(angular.isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort');
1390 });
1391 } else {
1392 $timeout(function() {
1393 handlePrematureEnd('timeout');
1394 }, timeout);
1395 }
1396 }
1397
1398 handleResponse.description = method + ' ' + url;
1399 return handleResponse;
1400
1401 function handleResponse() {
1402 var response = wrapped.response(method, url, data, headers, wrapped.params(url));
1403 xhr.$$respHeaders = response[2];
1404 callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
1405 copy(response[3] || ''), copy(response[4]));
1406 }
1407
1408 function handlePrematureEnd(reason) {
1409 for (var i = 0, ii = responses.length; i < ii; i++) {
1410 if (responses[i] === handleResponse) {
1411 responses.splice(i, 1);
1412 callback(-1, undefined, '', undefined, reason);
1413 break;
1414 }
1415 }
1416 }
1417 }
1418
1419 if (expectation && expectation.match(method, url)) {
1420 if (!expectation.matchData(data)) {

Callers 1

$httpBackendFunction · 0.70

Calls 1

handlePrematureEndFunction · 0.70

Tested by

no test coverage detected