Fixed the processing of headers.#1486
Conversation
0bb2ec4 to
4bdf586
Compare
4bdf586 to
a65751d
Compare
|
@KOLANICH Hi, could you provide some context about this pull request? |
|
I tried to remove (not redefine, but remove completely) some default headers, but there was no such a feature in this lib. I have implemented it. |
|
@KOLANICH If you want to remove or otherwise modify headers before sending them over the wire, you can do this: request = client.build_request(...)
# Modify `request.headers` as seems fit...
request.headers.pop("some-auto-header")
response = client.send(request)See also: https://www.python-httpx.org/advanced/#request-instances If I understood your use case correctly this should help you w/o requiring any modifications to HTTPX, so I'll close this tentatively. If that's not the case feel free to reach back. :-) |
|
This is different to My requirements about the headers are:
In
Currently it is easier for me (and, I guess, not only for me) to just use |
|
When creating this PR, it would have been incredibly helpful had you stated what your intention was (to increase
This has been a point of discussion for several things including query parameters that has come up several times before, and the
Seems like you could simply use your own fork of httpx with this modification and you would have the same ease of use as your own fork of hyper. |
The issue with headers mentioned here is not.
Not quite. There is a dict which is just merged to the provided dict. So I can set a dict with default headers and/or their order first, and second I can merge into it another dict.
It is not very wise to do that. I know, security through obscurity is an inherently flawed approach, but some websites send different content depending on a useragent in a non-ok way. |
Dropping in to clarify that sending a User-Agent by default is following HTTP spec recommendations. From RFC 7321 Section 5.5.3: |
OK (though, IMHO, it is still not OK to follow the flawed specs.) |
No description provided.