This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$http does not remove headers when functional config value returns null #5784
Closed
Description
From AngularJs docs (http://docs.angularjs.org/api/ng.$http#usage):
headers – {Object} – Map of strings or functions which return strings representing HTTP headers to send to the server.
If the return value of a function is null, the header will not be sent.
This can be reproduced via these lines in an app in 1.2.x:
$http.defaults.headers.common.Authorization = 'Basic';
$http({method:'GET',headers: { 'Authorization': function(){return null;}}, url: '/url'});
This code should not send a an Authorization header, but it does as of 1.2.x