diff --git a/CHANGES/3976.bugfix b/CHANGES/3976.bugfix new file mode 100644 index 00000000000..4e567ff3a11 --- /dev/null +++ b/CHANGES/3976.bugfix @@ -0,0 +1 @@ +Accept istr keys in LooseHeaders type hints. diff --git a/aiohttp/typedefs.py b/aiohttp/typedefs.py index d7c97a435dd..3c42f6abe30 100644 --- a/aiohttp/typedefs.py +++ b/aiohttp/typedefs.py @@ -12,7 +12,13 @@ Union, ) -from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy +from multidict import ( + CIMultiDict, + CIMultiDictProxy, + MultiDict, + MultiDictProxy, + istr, +) from yarl import URL DEFAULT_JSON_ENCODER = json.dumps @@ -33,7 +39,8 @@ Byteish = Union[bytes, bytearray, memoryview] JSONEncoder = Callable[[Any], str] JSONDecoder = Callable[[str], Any] -LooseHeaders = Union[Mapping[str, str], _CIMultiDict, _CIMultiDictProxy] +LooseHeaders = Union[Mapping[Union[str, istr], str], _CIMultiDict, + _CIMultiDictProxy] RawHeaders = Tuple[Tuple[bytes, bytes], ...] StrOrURL = Union[str, URL] LooseCookies = Union[Iterable[Tuple[str, 'BaseCookie[str]']],