httpx
httpx copied to clipboard
Relax `HeaderTypes` type alias definition
https://github.com/encode/httpx/blob/3aa441015820a41861bff9b0e78d787b1a4f2f68/httpx/_types.py#L46-L47
Could Dict be replaced with Mapping in this type definition?
This change would placate the type-checker when I do something like the following:
from collections.abc import Mapping
from typing import Final
_DEFAULT_HEADERS: Final[Mapping[str, str]] = {
# ...
}
when my intent is that the module-level dictionary is intended to be immutable but I don't want to go so far as to write a custom frozen dictionary or wrap it in types.MappingProxyType.
If this is acceptable, I'm happy to open a PR for the change. I was about to open a patch but your pull request template text made me think twice because this is more than just fixing a typo despite the tiny change.
Thanks!