Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit 4cbf13ece2e584b45b935df0a0c670e1863c4569.

authored by Michael Adkins · committed by GitHub · parent e27d1b8 · Browse files · 2 files+1 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+1 added−12 removed

  • tests:+0 added−7 removed
  • other:+1 added−5 removed

2 files+1 added−12 removed

modified:httpx/_utils.py+1 added-5 removed
65 unmodified lines
66 elif value is False:67 return "false"68 elif value is None:69 return ""70 elif isinstance(value, (str, float, int)):71 return str(value)70 return str(value)72 raise TypeError(73 f"Expected str, int, float, bool, or None. Got {type(value).__name__!r}."74 )717273def is_known_encoding(encoding: str) -> bool:74 """
455 unmodified lines
modified:tests/models/test_queryparams.py-7 removed
85 unmodified lines
86 q = httpx.QueryParams("a")87 assert str(q) == "a="888990def test_invalid_query_params():91 with pytest.raises(92 TypeError, match=r"Expected str, int, float, bool, or None. Got 'bytes'."93 ):94 httpx.QueryParams({"a": b"bytes"})959690def test_queryparam_update_is_hard_deprecated():91 q = httpx.QueryParams("a=123")92 with pytest.raises(RuntimeError):93 q.update({"a": "456"})
43 unmodified lines