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

Function defaultHttpResponseTransform

test/angular/1.5/angular.js:10870–10884  ·  view source on GitHub ↗
(data, headers)

Source from the content-addressed store, hash-verified

10868}
10869
10870function defaultHttpResponseTransform(data, headers) {
10871 if (isString(data)) {
10872 // Strip json vulnerability protection prefix and trim whitespace
10873 var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
10874
10875 if (tempData) {
10876 var contentType = headers('Content-Type');
10877 if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
10878 data = fromJson(tempData);
10879 }
10880 }
10881 }
10882
10883 return data;
10884}
10885
10886function isJsonLike(str) {
10887 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