Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions httpx/_models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -281,7 +281,7 @@ def update(self, params: QueryParamTypes = None) -> None:

params = QueryParams(params)
for param in params:
item, *extras = params.getlist(param)
item, *extras = params.get_list(param)
self[param] = item
if extras:
self._list.extend((param, e) for e in extras)
Expand DownExpand Up@@ -334,7 +334,7 @@ def getlist(self, key: typing.Any) -> typing.List[str]:
message = (
"QueryParams.getlist() is pending deprecation. Use QueryParams.get_list()"
)
warnings.warn(message, PendingDeprecationWarning)
warnings.warn(message, DeprecationWarning)
return self.get_list(key)


Expand DownExpand Up@@ -565,7 +565,7 @@ def __repr__(self) -> str:

def getlist(self, key: str, split_commas: bool = False) -> typing.List[str]:
message = "Headers.getlist() is pending deprecation. Use Headers.get_list()"
warnings.warn(message, PendingDeprecationWarning)
warnings.warn(message, DeprecationWarning)
return self.get_list(key, split_commas=split_commas)


Expand DownExpand Up@@ -795,7 +795,7 @@ def decoder(self) -> Decoder:
"""
if not hasattr(self, "_decoder"):
decoders: typing.List[Decoder] = []
values = self.headers.getlist("content-encoding", split_commas=True)
values = self.headers.get_list("content-encoding", split_commas=True)
for value in values:
value = value.strip().lower()
try:
Expand Down
4 changes: 4 additions & 0 deletions tests/models/test_headers.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,10 @@ def test_headers():
assert h.get("a") == "123, 456"
assert h.get("nope", default=None) is None
assert h.get_list("a") == ["123", "456"]

with pytest.warns(DeprecationWarning):
assert h.getlist("a") == ["123", "456"]

assert list(h.keys()) == ["a", "b"]
assert list(h.values()) == ["123, 456", "789"]
assert list(h.items()) == [("a", "123, 456"), ("b", "789")]
Expand Down
4 changes: 4 additions & 0 deletions tests/models/test_queryparams.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,10 @@ def test_queryparams(source):
assert q.get("a") == "456"
assert q.get("nope", default=None) is None
assert q.get_list("a") == ["123", "456"]

with pytest.warns(DeprecationWarning):
assert q.getlist("a") == ["123", "456"]

assert list(q.keys()) == ["a", "b"]
assert list(q.values()) == ["456", "789"]
assert list(q.items()) == [("a", "456"), ("b", "789")]
Expand Down