Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite default headers with undefined #1396

Open
absrd opened this issue Jun 20, 2016 · 4 comments
Open

Overwrite default headers with undefined #1396

absrd opened this issue Jun 20, 2016 · 4 comments

Comments

@absrd
Copy link

absrd commented Jun 20, 2016

Is there a way to set the default headers to undefined for a single request?
I'm well aware of the optional headers withHttpConfig, but it ignores undefined value(bug?), i.e. uses the default value, sets it to null when null is used and uses the default value when an empty object literal is given as the headers.

withHttpConfig doesn't in general work with headers, i.e. no provided value is used.

Use case:
The server uses the Authorization header as a scoping mechanism, where it has a different scope depending on whether there is an Authorization header.

We deal with the scoping by using default headers, but sometimes we've to do a single request in a different scope and would rather not unset and set default headers for that matter.

@daviesgeek
Copy link
Collaborator

This sounds like a bug; can you please provide a live example on Plunkr?

@absrd
Copy link
Author

absrd commented Jun 21, 2016

https://plnkr.co/edit/5HiwmcxBGmd2wudbsPhK?p=preview

Use console to check the resulting request headers. I've provided comments in the script.

I've provided wrong description to the problem, so allow me correct myself.

The withHttpConfig in general doesn't work with headers. No provided header is used. The behavior described above is for the optional headers one can provide for most of the defined request methods provided by restangular.

@daviesgeek
Copy link
Collaborator

Yikes. That is a bug. Would you mind submitting a PR to fix this?

@daviesgeek daviesgeek changed the title Overwrite default with undefined Overwrite default headers with undefined Aug 31, 2016
@nabbl
Copy link

nabbl commented Nov 18, 2016

Is this fixed yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants