You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by karosis88 July 28, 2023
I'm working on a library that implements HTTP Caching for httpx and httpcore (it provides transports and connection pools), and I'd like to add an extension that simply indicates whether or not the response was taken from the cache.
Unfortunately, the type of extension is Mapping, so this is an error for mypy.
error: Unsupported target for indexed assignment ("Mapping[Str, Any]") [index]
The solution is to simply change the extension type from Mapping to MutableMapping, allowing us to add custom extensions after the response has been created.
Discussed in #2793
Originally posted by karosis88 July 28, 2023
I'm working on a library that implements HTTP Caching for httpx and httpcore (it provides transports and connection pools), and I'd like to add an extension that simply indicates whether or not the response was taken from the cache.
Unfortunately, the type of extension is Mapping, so this is an error for mypy.
OUTPUT
The solution is to simply change the extension type from
Mapping
toMutableMapping
, allowing us to add custom extensions after the response has been created.See also this pr
I believe the only change needed is in the "_models.py" file.
The text was updated successfully, but these errors were encountered: