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

Removing header from client? #2279

Open
MarcoLugo opened this issue May 7, 2024 · 1 comment
Open

Removing header from client? #2279

MarcoLugo opened this issue May 7, 2024 · 1 comment

Comments

@MarcoLugo
Copy link

Hi,

I would like to make a HTTP request without the Accept header which seems to be baked in here. default_headers only adds headers but cannot remove the Accept already inserting and the header/s method would only its value. Is there a way to remove the Accept header?

As far as I can see, it shouldn't be controversial to at least allow not having an Accept header, from an older RFC:

If no Accept header field is present, then it is assumed that the
client accepts all media types. If an Accept header field is present,
and if the server cannot send a response which is acceptable
according to the combined Accept field value, then the server SHOULD
send a 406 (not acceptable) response.

The newer RFC does not seem to make it mandatory either. I see that this issue came up previously but it's not clear to me why there was no follow up. If there's no strong reason against it, could this be implemented or a contributing PR in this sense be considered?

Thank you.

@valaphee
Copy link

It's also possible in curl to remove default headers: https://curl.se/libcurl/c/httpcustomheader.html

Even though there syntax is a bit weird with "Accept:" for removing, and "X-silly-header;" for an empty header.

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

No branches or pull requests

2 participants