Unable to remove default headers with method remove_header #263

Closed
arturogzz opened this Issue Jul 2, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@arturogzz

When trying to replace the headers, set them empty or to remove the default methods and add new ones, the method remove_header has no impact on (at least) a request message type.

For example client::request<<remove_header("Content-Type") and client::request<<remove_header("Accept") used for removing default headers has no effect in removing the mentioned headers. Adding a header aftwerwards will add it additionally, hence the desired action, replacing the default headers with custom ones might not happen.

@ghost ghost assigned deanberris Jul 2, 2013

@deanberris

This comment has been minimized.

Show comment
Hide comment
@deanberris

deanberris Jul 2, 2013

Member

So technically there's a way around this where you set the Content-Type and/or Accept headers to be empty (or whatever value you want). If you do this and the defaults still clobber what you've set, then I can fix that bug.

What I intend to do though is to allow users to set Accept/Content-Type and other defaulted headers to be empty, in which case they will be removed. I know this is not intuitive but until the rewrite is complete, there's no easy way to set these defaults from the client options (where they should really be set).

Can you comment on whether setting the headers explicitly don't get clobbered anyway?

Member

deanberris commented Jul 2, 2013

So technically there's a way around this where you set the Content-Type and/or Accept headers to be empty (or whatever value you want). If you do this and the defaults still clobber what you've set, then I can fix that bug.

What I intend to do though is to allow users to set Accept/Content-Type and other defaulted headers to be empty, in which case they will be removed. I know this is not intuitive but until the rewrite is complete, there's no easy way to set these defaults from the client options (where they should really be set).

Can you comment on whether setting the headers explicitly don't get clobbered anyway?

deanberris added a commit that referenced this issue Jul 4, 2013

Allow overriding defaulted headers.
This change Fixes the linearization of HTTP requests so that two things
happen:

- empty headers are ignored
- explicitly defining the defaulted headers will suppress defaults

Fixes #263

@deanberris deanberris closed this Jul 5, 2013

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