* @ngdoc provider * @name $httpProvider * @description * Use `$httpProvider` to change the default behavior of the ng.$http $http service. *
()
| 9355 | * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. |
| 9356 | * */ |
| 9357 | function $HttpProvider() { |
| 9358 | /** |
| 9359 | * @ngdoc property |
| 9360 | * @name $httpProvider#defaults |
| 9361 | * @description |
| 9362 | * |
| 9363 | * Object containing default values for all {@link ng.$http $http} requests. |
| 9364 | * |
| 9365 | * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`} |
| 9366 | * that will provide the cache for all requests who set their `cache` property to `true`. |
| 9367 | * If you set the `defaults.cache = false` then only requests that specify their own custom |
| 9368 | * cache object will be cached. See {@link $http#caching $http Caching} for more information. |
| 9369 | * |
| 9370 | * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. |
| 9371 | * Defaults value is `'XSRF-TOKEN'`. |
| 9372 | * |
| 9373 | * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the |
| 9374 | * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. |
| 9375 | * |
| 9376 | * - **`defaults.headers`** - {Object} - Default headers for all $http requests. |
| 9377 | * Refer to {@link ng.$http#setting-http-headers $http} for documentation on |
| 9378 | * setting default headers. |
| 9379 | * - **`defaults.headers.common`** |
| 9380 | * - **`defaults.headers.post`** |
| 9381 | * - **`defaults.headers.put`** |
| 9382 | * - **`defaults.headers.patch`** |
| 9383 | * |
| 9384 | * |
| 9385 | * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function |
| 9386 | * used to the prepare string representation of request parameters (specified as an object). |
| 9387 | * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}. |
| 9388 | * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}. |
| 9389 | * |
| 9390 | **/ |
| 9391 | var defaults = this.defaults = { |
| 9392 | // transform incoming response data |
| 9393 | transformResponse: [defaultHttpResponseTransform], |
| 9394 | |
| 9395 | // transform outgoing request data |
| 9396 | transformRequest: [function(d) { |
| 9397 | return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; |
| 9398 | }], |
| 9399 | |
| 9400 | // default headers |
| 9401 | headers: { |
| 9402 | common: { |
| 9403 | 'Accept': 'application/json, text/plain, */*' |
| 9404 | }, |
| 9405 | post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), |
| 9406 | put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), |
| 9407 | patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) |
| 9408 | }, |
| 9409 | |
| 9410 | xsrfCookieName: 'XSRF-TOKEN', |
| 9411 | xsrfHeaderName: 'X-XSRF-TOKEN', |
| 9412 | |
| 9413 | paramSerializer: '$httpParamSerializer' |
| 9414 | }; |
nothing calls this directly
no test coverage detected