MCPcopy
hub / github.com/angular-ui/ui-router / $HttpProvider

Function $HttpProvider

test/angular/1.5/angular.js:10989–12121  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

10987 * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
10988 * */
10989function $HttpProvider() {
10990 /**
10991 * @ngdoc property
10992 * @name $httpProvider#defaults
10993 * @description
10994 *
10995 * Object containing default values for all {@link ng.$http $http} requests.
10996 *
10997 * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with
10998 * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses
10999 * by default. See {@link $http#caching $http Caching} for more information.
11000 *
11001 * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
11002 * Defaults value is `'XSRF-TOKEN'`.
11003 *
11004 * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
11005 * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
11006 *
11007 * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
11008 * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
11009 * setting default headers.
11010 * - **`defaults.headers.common`**
11011 * - **`defaults.headers.post`**
11012 * - **`defaults.headers.put`**
11013 * - **`defaults.headers.patch`**
11014 *
11015 *
11016 * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
11017 * used to the prepare string representation of request parameters (specified as an object).
11018 * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
11019 * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
11020 *
11021 **/
11022 var defaults = this.defaults = {
11023 // transform incoming response data
11024 transformResponse: [defaultHttpResponseTransform],
11025
11026 // transform outgoing request data
11027 transformRequest: [function(d) {
11028 return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
11029 }],
11030
11031 // default headers
11032 headers: {
11033 common: {
11034 'Accept': 'application/json, text/plain, */*'
11035 },
11036 post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
11037 put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
11038 patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
11039 },
11040
11041 xsrfCookieName: 'XSRF-TOKEN',
11042 xsrfHeaderName: 'X-XSRF-TOKEN',
11043
11044 paramSerializer: '$httpParamSerializer'
11045 };
11046

Callers

nothing calls this directly

Calls 11

isObjectFunction · 0.70
isFileFunction · 0.70
isBlobFunction · 0.70
isFormDataFunction · 0.70
toJsonFunction · 0.70
shallowCopyFunction · 0.70
isDefinedFunction · 0.70
isStringFunction · 0.70
forEachFunction · 0.70
createShortMethodsFunction · 0.70

Tested by

no test coverage detected