* @ngdoc provider * @name $httpProvider * @description * Use `$httpProvider` to change the default behavior of the ng.$http $http service. *
()
| 9830 | * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. |
| 9831 | * */ |
| 9832 | function $HttpProvider() { |
| 9833 | /** |
| 9834 | * @ngdoc property |
| 9835 | * @name $httpProvider#defaults |
| 9836 | * @description |
| 9837 | * |
| 9838 | * Object containing default values for all {@link ng.$http $http} requests. |
| 9839 | * |
| 9840 | * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with |
| 9841 | * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses |
| 9842 | * by default. See {@link $http#caching $http Caching} for more information. |
| 9843 | * |
| 9844 | * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. |
| 9845 | * Defaults value is `'XSRF-TOKEN'`. |
| 9846 | * |
| 9847 | * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the |
| 9848 | * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. |
| 9849 | * |
| 9850 | * - **`defaults.headers`** - {Object} - Default headers for all $http requests. |
| 9851 | * Refer to {@link ng.$http#setting-http-headers $http} for documentation on |
| 9852 | * setting default headers. |
| 9853 | * - **`defaults.headers.common`** |
| 9854 | * - **`defaults.headers.post`** |
| 9855 | * - **`defaults.headers.put`** |
| 9856 | * - **`defaults.headers.patch`** |
| 9857 | * |
| 9858 | * |
| 9859 | * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function |
| 9860 | * used to the prepare string representation of request parameters (specified as an object). |
| 9861 | * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}. |
| 9862 | * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}. |
| 9863 | * |
| 9864 | **/ |
| 9865 | var defaults = this.defaults = { |
| 9866 | // transform incoming response data |
| 9867 | transformResponse: [defaultHttpResponseTransform], |
| 9868 | |
| 9869 | // transform outgoing request data |
| 9870 | transformRequest: [function(d) { |
| 9871 | return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; |
| 9872 | }], |
| 9873 | |
| 9874 | // default headers |
| 9875 | headers: { |
| 9876 | common: { |
| 9877 | 'Accept': 'application/json, text/plain, */*' |
| 9878 | }, |
| 9879 | post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), |
| 9880 | put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), |
| 9881 | patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) |
| 9882 | }, |
| 9883 | |
| 9884 | xsrfCookieName: 'XSRF-TOKEN', |
| 9885 | xsrfHeaderName: 'X-XSRF-TOKEN', |
| 9886 | |
| 9887 | paramSerializer: '$httpParamSerializer' |
| 9888 | }; |
| 9889 |
nothing calls this directly
no test coverage detected