Removing header from client?
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.
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.
For methods like DELETE which return no response body, an accept header isn't necessary. We removed these from our generated client code but are seeing reqwest put them back into the recorded HTTP sessions.