You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Activity
daviesgeek commentedon Jun 20, 2016
This sounds like a bug; can you please provide a live example on Plunkr?
absrd commentedon 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 commentedon Aug 31, 2016
Yikes. That is a bug. Would you mind submitting a PR to fix this?
[-]Overwrite default with undefined[/-][+]Overwrite default headers with undefined[/+]nabbl commentedon Nov 18, 2016
Is this fixed yet?