()
| 8524 | |
| 8525 | |
| 8526 | function $HttpProvider() { |
| 8527 | var JSON_START = /^\s*(\[|\{[^\{])/, |
| 8528 | JSON_END = /[\}\]]\s*$/, |
| 8529 | PROTECTION_PREFIX = /^\)\]\}',?\n/; |
| 8530 | |
| 8531 | var $config = this.defaults = { |
| 8532 | // transform incoming response data |
| 8533 | transformResponse: [function(data) { |
| 8534 | if (isString(data)) { |
| 8535 | // strip json vulnerability protection prefix |
| 8536 | data = data.replace(PROTECTION_PREFIX, ''); |
| 8537 | if (JSON_START.test(data) && JSON_END.test(data)) |
| 8538 | data = fromJson(data, true); |
| 8539 | } |
| 8540 | return data; |
| 8541 | }], |
| 8542 | |
| 8543 | // transform outgoing request data |
| 8544 | transformRequest: [function(d) { |
| 8545 | return isObject(d) && !isFile(d) ? toJson(d) : d; |
| 8546 | }], |
| 8547 | |
| 8548 | // default headers |
| 8549 | headers: { |
| 8550 | common: { |
| 8551 | 'Accept': 'application/json, text/plain, */*', |
| 8552 | 'X-Requested-With': 'XMLHttpRequest' |
| 8553 | }, |
| 8554 | post: {'Content-Type': 'application/json;charset=utf-8'}, |
| 8555 | put: {'Content-Type': 'application/json;charset=utf-8'} |
| 8556 | } |
| 8557 | }; |
| 8558 | |
| 8559 | var providerResponseInterceptors = this.responseInterceptors = []; |
| 8560 | |
| 8561 | this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector', |
| 8562 | function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) { |
| 8563 | |
| 8564 | var defaultCache = $cacheFactory('$http'), |
| 8565 | responseInterceptors = []; |
| 8566 | |
| 8567 | forEach(providerResponseInterceptors, function(interceptor) { |
| 8568 | responseInterceptors.push( |
| 8569 | isString(interceptor) |
| 8570 | ? $injector.get(interceptor) |
| 8571 | : $injector.invoke(interceptor) |
| 8572 | ); |
| 8573 | }); |
| 8574 | |
| 8575 | |
| 8576 | /** |
| 8577 | * @ngdoc function |
| 8578 | * @name ng.$http |
| 8579 | * @requires $httpBackend |
| 8580 | * @requires $browser |
| 8581 | * @requires $cacheFactory |
| 8582 | * @requires $rootScope |
| 8583 | * @requires $q |
nothing calls this directly
no test coverage detected