@@ -266,12 +266,6 @@ function $HttpProvider() {
266
266
* {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses
267
267
* by default. See {@link $http#caching $http Caching} for more information.
268
268
*
269
- * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
270
- * Defaults value is `'XSRF-TOKEN'`.
271
- *
272
- * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
273
- * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
274
- *
275
269
* - **`defaults.headers`** - {Object} - Default headers for all $http requests.
276
270
* Refer to {@link ng.$http#setting-http-headers $http} for documentation on
277
271
* setting default headers.
@@ -280,15 +274,38 @@ function $HttpProvider() {
280
274
* - **`defaults.headers.put`**
281
275
* - **`defaults.headers.patch`**
282
276
*
277
+ * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the
278
+ * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the
279
+ * {@link $jsonpCallbacks} service. Defaults to `'callback'`.
283
280
*
284
281
* - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
285
282
* used to the prepare string representation of request parameters (specified as an object).
286
283
* If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
287
284
* Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
288
285
*
289
- * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the
290
- * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the
291
- * {@link $jsonpCallbacks} service. Defaults to `'callback'`.
286
+ * - **`defaults.transformRequest`** -
287
+ * `{Array<function(data, headersGetter)>|function(data, headersGetter)}` -
288
+ * An array of functions (or a single function) which are applied to the request data.
289
+ * By default, this is an array with one request transformation function:
290
+ *
291
+ * - If the `data` property of the request configuration object contains an object, serialize it
292
+ * into JSON format.
293
+ *
294
+ * - **`defaults.transformResponse`** -
295
+ * `{Array<function(data, headersGetter, status)>|function(data, headersGetter, status)}` -
296
+ * An array of functions (or a single function) which are applied to the response data. By default,
297
+ * this is an array which applies one response transformation function that does two things:
298
+ *
299
+ * - If XSRF prefix is detected, strip it
300
+ * (see {@link ng.$http#security-considerations Security Considerations in the $http docs}).
301
+ * - If the `Content-Type` is `application/json` or the response looks like JSON,
302
+ * deserialize it using a JSON parser.
303
+ *
304
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
305
+ * Defaults value is `'XSRF-TOKEN'`.
306
+ *
307
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
308
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
292
309
*
293
310
**/
294
311
var defaults = this . defaults = {
@@ -552,15 +569,18 @@ function $HttpProvider() {
552
569
*
553
570
* Angular provides the following default transformations:
554
571
*
555
- * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):
572
+ * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`) is
573
+ * an array with one function that does the following:
556
574
*
557
575
* - If the `data` property of the request configuration object contains an object, serialize it
558
576
* into JSON format.
559
577
*
560
- * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):
578
+ * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`) is
579
+ * an array with one function that does the following:
561
580
*
562
581
* - If XSRF prefix is detected, strip it (see Security Considerations section below).
563
- * - If JSON response is detected, deserialize it using a JSON parser.
582
+ * - If the `Content-Type` is `application/json` or the response looks like JSON,
583
+ * deserialize it using a JSON parser.
564
584
*
565
585
*
566
586
* ### Overriding the Default Transformations Per Request
0 commit comments