Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Raise TypeError on invalid query params. (#2523)" #2539

Merged
merged 1 commit into from
Jan 4, 2023
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
6 changes: 1 addition & 5 deletions httpx/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ def primitive_value_to_str(value: "PrimitiveData") -> str:
return "false"
elif value is None:
return ""
elif isinstance(value, (str, float, int)):
return str(value)
raise TypeError(
f"Expected str, int, float, bool, or None. Got {type(value).__name__!r}."
)
return str(value)


def is_known_encoding(encoding: str) -> bool:
Expand Down
7 changes: 0 additions & 7 deletions tests/models/test_queryparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ def test_empty_query_params():
assert str(q) == "a="


def test_invalid_query_params():
with pytest.raises(
TypeError, match=r"Expected str, int, float, bool, or None. Got 'bytes'."
):
httpx.QueryParams({"a": b"bytes"})


def test_queryparam_update_is_hard_deprecated():
q = httpx.QueryParams("a=123")
with pytest.raises(RuntimeError):
Expand Down