MCPcopy Index your code
hub / github.com/angular-ui/ui-router / defaultHttpResponseTransform

Function defaultHttpResponseTransform

test/angular/1.3/angular.js:8633–8647  ·  view source on GitHub ↗
(data, headers)

Source from the content-addressed store, hash-verified

8631var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
8632
8633function defaultHttpResponseTransform(data, headers) {
8634 if (isString(data)) {
8635 // Strip json vulnerability protection prefix and trim whitespace
8636 var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
8637
8638 if (tempData) {
8639 var contentType = headers('Content-Type');
8640 if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
8641 data = fromJson(tempData);
8642 }
8643 }
8644 }
8645
8646 return data;
8647}
8648
8649function isJsonLike(str) {
8650 var jsonStart = str.match(JSON_START);

Callers

nothing calls this directly

Calls 3

isStringFunction · 0.70
isJsonLikeFunction · 0.70
fromJsonFunction · 0.70

Tested by

no test coverage detected