From 54e8cc8f02d310fdd6e691bb363e2a5d8ae47967 Mon Sep 17 00:00:00 2001 From: Dustin Chilson Date: Thu, 20 Nov 2014 10:14:25 -0500 Subject: [PATCH] docs($http): Describe how to remove a header on a per request basis. --- src/ng/http.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ng/http.js b/src/ng/http.js index 57afa3dd70d4..124a70da64e5 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -343,6 +343,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 *