Skip to content

Commit 6775972

Browse files
corytheboydpetebacondarwin
authored andcommitted
docs($httpProvider): add missing documentation
Add documentation for $httpProvider default values Closes angular#7782
1 parent 1fcbb69 commit 6775972

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/ng/http.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,40 @@ function isSuccess(status) {
8383
}
8484

8585

86+
/**
87+
* @ngdoc provider
88+
* @name $httpProvider
89+
* @description
90+
* Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
91+
* */
8692
function $HttpProvider() {
8793
var JSON_START = /^\s*(\[|\{[^\{])/,
8894
JSON_END = /[\}\]]\s*$/,
8995
PROTECTION_PREFIX = /^\)\]\}',?\n/,
9096
CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};
9197

98+
/**
99+
* @ngdoc property
100+
* @name $httpProvider#defaults
101+
* @description
102+
*
103+
* Object containing default values for all {@link ng.$http $http} requests.
104+
*
105+
* - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
106+
* Defaults value is `'XSRF-TOKEN'`.
107+
*
108+
* - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
109+
* XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
110+
*
111+
* - **`defaults.headers`** - {Object} - Default headers for all $http requests.
112+
* Refer to {@link ng.$http#setting-http-headers $http} for documentation on
113+
* setting default headers.
114+
* - **`defaults.headers.common`**
115+
* - **`defaults.headers.post`**
116+
* - **`defaults.headers.put`**
117+
* - **`defaults.headers.patch`**
118+
* */
92119
var defaults = this.defaults = {
93-
// transform incoming response data
94120
transformResponse: [function(data) {
95121
if (isString(data)) {
96122
// strip json vulnerability protection prefix
@@ -106,7 +132,6 @@ function $HttpProvider() {
106132
return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;
107133
}],
108134

109-
// default headers
110135
headers: {
111136
common: {
112137
'Accept': 'application/json, text/plain, */*'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy