docs($http): describe how to remove a header on a per request basis

Closes #10144
This commit is contained in:
Dustin Chilson
2014-11-20 10:14:25 -05:00
committed by Caitlin Potter
parent 1b275fb00e
commit 5388ca5710

View File

@@ -349,6 +349,21 @@ function $HttpProvider() {
* 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.
*
* To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,
* Use the `headers` property, setting the desired header to `undefined`. For example:
*
* ```
* var req = {
* method: 'POST',
* url: 'http://example.com',
* headers: {
* 'Content-Type': undefined
* },
* data: { test: 'test' },
* }
*
* $http(req).success(function(){...}).error(function(){...});
* ```
*
* ## Transforming Requests and Responses
*