Skip to content
This repository has been 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
perek opened this issue Jan 14, 2014 · 1 comment
Closed

Comments

@perek
Copy link
Contributor

perek commented Jan 14, 2014

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

@clakech
Copy link
Contributor

clakech commented Jan 27, 2014

👍 I confirm this issue here with 1.2.8

perek pushed a commit to perek/angular.js that referenced this issue Mar 15, 2014
perek pushed a commit to perek/angular.js that referenced this issue Mar 15, 2014
perek pushed a commit to perek/angular.js that referenced this issue Mar 15, 2014
perek pushed a commit to perek/angular.js that referenced this issue Mar 15, 2014
perek pushed a commit to perek/angular.js that referenced this issue Mar 16, 2014
Closes angular#5784

fix($http) - run execHeaders on merged header object

fixes angular#5784

fix($http) - remove unnecessary execHeaders call

The defHeaders object is merged into the reqHeaders object. The
combined object is then passed into execHeaders which evaluates all
header functions.

test($http) - simplify testing of default header functions

Remove unneeded 'should override default headers with header function'.
@Narretz Narretz added this to the Backlog milestone Jul 2, 2014
IgorMinar pushed a commit that referenced this issue Jul 10, 2014
ckknight pushed a commit to ckknight/angular.js that referenced this issue Jul 16, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants