]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Switch `extensions` from `Dict` to `Mapping`. (#2465)
authorTom Christie <tom@tomchristie.com>
Mon, 28 Nov 2022 12:29:02 +0000 (12:29 +0000)
committerGitHub <noreply@github.com>
Mon, 28 Nov 2022 12:29:02 +0000 (12:29 +0000)
* Ignore Mapping -> Dict type error

* Fix type of ResponseExtension

* Switch extensions from Dict to Mapping

httpx/_client.py
httpx/_types.py

index f4c62ac4778732fa59dd74c33d8bfa2b1deb2325..2d9ff622ab487db45104c818743bdd3fd80a2964 100644 (file)
@@ -356,7 +356,7 @@ class BaseClient:
                 if isinstance(timeout, UseClientDefault)
                 else Timeout(timeout)
             )
-            extensions["timeout"] = timeout.as_dict()
+            extensions = dict(**extensions, timeout=timeout.as_dict())
         return Request(
             method,
             url,
index 08fee30b7da59945d6dad87d09c26c7a3086d194..effed6260e2e934d39ee3b7a3bb863a1af72fa21 100644 (file)
@@ -76,7 +76,7 @@ AuthTypes = Union[
 
 RequestContent = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]]
 ResponseContent = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]]
-ResponseExtensions = Dict[str, Any]
+ResponseExtensions = Mapping[str, Any]
 
 RequestData = Mapping[str, Any]
 
@@ -93,7 +93,7 @@ FileTypes = Union[
 ]
 RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]]
 
-RequestExtensions = Dict[str, Any]
+RequestExtensions = Mapping[str, Any]
 
 
 class SyncByteStream: