# Interface HttpProviderDefaults

Object that controls the defaults for $http provider. Not all fields of RequestShortcutConfig can be configured via defaults and the docs do not say which. The following is based on the inspection of the source code. https://docs.angularjs.org/api/ng/service/$http#defaults https://docs.angularjs.org/api/ng/service/$http#usage https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section

interface HttpProviderDefaults {
cache?: any;
headers?: HttpRequestConfigHeaders;
paramSerializer?: string | ((obj: any) => string);
transformRequest?: HttpRequestTransformer | HttpRequestTransformer[];
transformResponse?: HttpResponseTransformer | HttpResponseTransformer[];
withCredentials?: boolean;
xsrfCookieName?: string;
xsrfHeaderName?: string;
}

#### Hierarchy (View Summary)

- HttpProviderDefaults
  - RequestShortcutConfig

##### Index

### Properties

cache?
headers?
paramSerializer?
transformRequest?
transformResponse?
withCredentials?
xsrfCookieName?
xsrfHeaderName?

## Properties

### `Optional` cache

cache?: any

{boolean|Cache} If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.

### `Optional` headers

headers?: HttpRequestConfigHeaders

Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent. The key of the map is the request verb in lower case. The "common" key applies to all requests.

#### See

https://docs.angularjs.org/api/ng/service/$http#setting-http-headers

### `Optional` paramSerializer

paramSerializer?: string | ((obj: any) => 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.

### `Optional` transformRequest

transformRequest?: HttpRequestTransformer | HttpRequestTransformer[]

Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version.

#### See

https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses

### `Optional` transformResponse

transformResponse?: HttpResponseTransformer | HttpResponseTransformer[]

Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version.

### `Optional` withCredentials

withCredentials?: boolean

whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.

### `Optional` xsrfCookieName

xsrfCookieName?: string

Name of cookie containing the XSRF token.

### `Optional` xsrfHeaderName

xsrfHeaderName?: string

Name of HTTP header to populate with the XSRF token.