Keep Headers._encoding when constructing from another Headers instance #3763
Unanswered
FatimahAlhumaidhi
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m trying to build a custom client that defaults header encoding to UTF-8 (related: #3238).
While looking at
httpx.Headers.__init__, it seems that when you pass an existing Headers instance, it copies ._list but ignores ._encoding.httpx/httpx/_models.py
Lines 151 to 164 in ae1b9f6
If I do Headers(existing_headers) (what BaseClient._merge_headers does), I expected it to behave like a copy — including keeping the same encoding — unless I explicitly pass encoding=.
I believe it should carry over its encoding (unless encoding is provided):
If this is intentional, what’s the recommended way to make a client default to UTF-8 header encoding without losing it when headers get copied around?
Beta Was this translation helpful? Give feedback.
All reactions