Overview

Use $httpProvider to change the default behavior of the $http service.

Methods

useApplyAsync([value]);

Configure $http service to combine processing of multiple http responses received at around the same time via $rootScope.$applyAsync. This can result in significant performance improvement for bigger applications that make many HTTP requests concurrently (common during application bootstrap).

Defaults to false. If no value is specified, returns the current configured value.

Parameters

Param

Type

Details

value

(optional)

boolean

If true, when requests are loaded, they will schedule a deferred "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window to load and share the same digest cycle.

Returns

booleanObject

If a value is specified, returns the $httpProvider for chaining. otherwise, returns the current configured value.

defaults.jsonpCallbackParam - {string} - the name of the query parameter that passes the name of the callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the $jsonpCallbacks service. Defaults to 'callback'.

defaults.paramSerializer - {string|function(Object<string,string>):string} - A function used to the prepare string representation of request parameters (specified as an object). If specified as string, it is interpreted as a function registered with the $injector. Defaults to $httpParamSerializer.

defaults.transformRequest - {Array<function(data, headersGetter)>|function(data, headersGetter)} - An array of functions (or a single function) which are applied to the request data. By default, this is an array with one request transformation function:

If the data property of the request configuration object contains an object, serialize it into JSON format.

defaults.transformResponse - {Array<function(data, headersGetter, status)>|function(data, headersGetter, status)} - An array of functions (or a single function) which are applied to the response data. By default, this is an array which applies one response transformation function that does two things: