Skip to content

Overwrite default headers with undefined #1396

Open

Description

@absrd

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.

Activity

  1. daviesgeek commented on Jun 20, 2016

    @daviesgeek
    Collaborator

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

  2. absrd commented on Jun 21, 2016

    @absrd
    Author

    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.

  3. daviesgeek commented on Aug 31, 2016

    @daviesgeek
    Collaborator

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

  4. changed the title [-]Overwrite default with undefined[/-] [+]Overwrite default headers with undefined[/+] on Aug 31, 2016
  5. nabbl commented on Nov 18, 2016

    @nabbl

    Is this fixed yet?

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions