mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-05 17:01:19 +08:00
docs($http): makes clear $httpProvider.defaults are available at run-time
Clarifies some confusion around $http.defaults existing and able to be modified at run-time, for when run-time services may be needed in a transformation. Closes #5559 Closes #5630
This commit is contained in:
@@ -291,7 +291,15 @@ function $HttpProvider() {
|
||||
* `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
|
||||
*
|
||||
* The defaults can also be set at runtime via the `$http.defaults` object in the same
|
||||
* fashion. In addition, you can supply a `headers` property in the config object passed when
|
||||
* fashion. For example:
|
||||
*
|
||||
* ```
|
||||
* module.run(function($http) {
|
||||
* $http.defaults.headers.common.Authentication = 'Basic YmVlcDpib29w'
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* In addition, you can supply a `headers` property in the config object passed when
|
||||
* calling `$http(config)`, which overrides the defaults without changing them globally.
|
||||
*
|
||||
*
|
||||
@@ -315,7 +323,9 @@ function $HttpProvider() {
|
||||
* properties. These properties are by default an array of transform functions, which allows you
|
||||
* to `push` or `unshift` a new transformation function into the transformation chain. You can
|
||||
* also decide to completely override any default transformations by assigning your
|
||||
* transformation functions to these properties directly without the array wrapper.
|
||||
* transformation functions to these properties directly without the array wrapper. These defaults
|
||||
* are again available on the $http factory at run-time, which may be useful if you have run-time
|
||||
* services you wish to be involved in your transformations.
|
||||
*
|
||||
* Similarly, to locally override the request/response transforms, augment the
|
||||
* `transformRequest` and/or `transformResponse` properties of the configuration object passed
|
||||
@@ -529,7 +539,8 @@ function $HttpProvider() {
|
||||
* for added security.
|
||||
*
|
||||
* The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
|
||||
* properties of either $httpProvider.defaults, or the per-request config object.
|
||||
* properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
|
||||
* or the per-request config object.
|
||||
*
|
||||
*
|
||||
* @param {object} config Object describing the request to be made and how it should be
|
||||
|
||||
Reference in New Issue
Block a user