MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / $HttpProvider

Function $HttpProvider

code/songhop/www/lib/angular/angular.js:8638–9671  ·  view source on GitHub ↗

* @ngdoc provider * @name $httpProvider * @description * Use `$httpProvider` to change the default behavior of the ng.$http $http service. *

()

Source from the content-addressed store, hash-verified

8636 * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
8637 * */
8638function $HttpProvider() {
8639 /**
8640 * @ngdoc property
8641 * @name $httpProvider#defaults
8642 * @description
8643 *
8644 * Object containing default values for all {@link ng.$http $http} requests.
8645 *
8646 * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
8647 * that will provide the cache for all requests who set their `cache` property to `true`.
8648 * If you set the `default.cache = false` then only requests that specify their own custom
8649 * cache object will be cached. See {@link $http#caching $http Caching} for more information.
8650 *
8651 * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
8652 * Defaults value is `'XSRF-TOKEN'`.
8653 *
8654 * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
8655 * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
8656 *
8657 * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
8658 * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
8659 * setting default headers.
8660 * - **`defaults.headers.common`**
8661 * - **`defaults.headers.post`**
8662 * - **`defaults.headers.put`**
8663 * - **`defaults.headers.patch`**
8664 *
8665 **/
8666 var defaults = this.defaults = {
8667 // transform incoming response data
8668 transformResponse: [defaultHttpResponseTransform],
8669
8670 // transform outgoing request data
8671 transformRequest: [function(d) {
8672 return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;
8673 }],
8674
8675 // default headers
8676 headers: {
8677 common: {
8678 'Accept': 'application/json, text/plain, */*'
8679 },
8680 post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
8681 put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
8682 patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
8683 },
8684
8685 xsrfCookieName: 'XSRF-TOKEN',
8686 xsrfHeaderName: 'X-XSRF-TOKEN'
8687 };
8688
8689 var useApplyAsync = false;
8690 /**
8691 * @ngdoc method
8692 * @name $httpProvider#useApplyAsync
8693 * @description
8694 *
8695 * Configure $http service to combine processing of multiple http responses received at around

Callers

nothing calls this directly

Calls 11

getMethod · 0.80
isObjectFunction · 0.70
isFileFunction · 0.70
isBlobFunction · 0.70
toJsonFunction · 0.70
shallowCopyFunction · 0.70
isDefinedFunction · 0.70
forEachFunction · 0.70
isStringFunction · 0.70
createShortMethodsFunction · 0.70

Tested by

no test coverage detected