MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / $HttpProvider

Function $HttpProvider

web/static/bower_components/angular/angular.js:9523–10585  ·  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

9521 * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
9522 * */
9523function $HttpProvider() {
9524 /**
9525 * @ngdoc property
9526 * @name $httpProvider#defaults
9527 * @description
9528 *
9529 * Object containing default values for all {@link ng.$http $http} requests.
9530 *
9531 * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
9532 * that will provide the cache for all requests who set their `cache` property to `true`.
9533 * If you set the `defaults.cache = false` then only requests that specify their own custom
9534 * cache object will be cached. See {@link $http#caching $http Caching} for more information.
9535 *
9536 * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
9537 * Defaults value is `'XSRF-TOKEN'`.
9538 *
9539 * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
9540 * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
9541 *
9542 * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
9543 * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
9544 * setting default headers.
9545 * - **`defaults.headers.common`**
9546 * - **`defaults.headers.post`**
9547 * - **`defaults.headers.put`**
9548 * - **`defaults.headers.patch`**
9549 *
9550 *
9551 * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
9552 * used to the prepare string representation of request parameters (specified as an object).
9553 * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
9554 * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
9555 *
9556 **/
9557 var defaults = this.defaults = {
9558 // transform incoming response data
9559 transformResponse: [defaultHttpResponseTransform],
9560
9561 // transform outgoing request data
9562 transformRequest: [function(d) {
9563 return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
9564 }],
9565
9566 // default headers
9567 headers: {
9568 common: {
9569 'Accept': 'application/json, text/plain, */*'
9570 },
9571 post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
9572 put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
9573 patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
9574 },
9575
9576 xsrfCookieName: 'XSRF-TOKEN',
9577 xsrfHeaderName: 'X-XSRF-TOKEN',
9578
9579 paramSerializer: '$httpParamSerializer'
9580 };

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected