Skip to content
Myr

Support QueryParams(None) (#1060)

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

authored by Tom Christie · committed by GitHub · parent ccd4711 · Browse files · 4 files+5 added−4 removed
This commit

State

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

Diff stats

4 files+5 added−4 removed

  • tests:+3 added−0 removed
  • other:+2 added−4 removed

4 files+5 added−4 removed

modified:httpx/_client.py-3 removed
71 unmodified lines
72 self.base_url = URL("", allow_relative=True)73 else:74 self.base_url = URL(base_url)7576 if params is None:77 params = {}7876 self.auth = auth77 self._params = QueryParams(params)78 self._headers = Headers(headers)79 self._cookies = Cookies(cookies)
1436 unmodified lines
modified:httpx/_models.py+1 added-1 removed
285 unmodified lines
286287 value = args[0] if args else kwargs288289 items: typing.Sequence[typing.Tuple[str, PrimitiveData]]290 if isinstance(value, str):290 if value is None or isinstance(value, str):291 items = parse_qsl(value)292 elif isinstance(value, QueryParams):293 items = value.multi_items()294 elif isinstance(value, list):
900 unmodified lines
modified:httpx/_types.py+1 added
32 unmodified lines
33 "QueryParams",34 Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]],35 List[Tuple[str, PrimitiveData]],36 str,37 None,38]3940HeaderTypes = Union[41 "Headers",
35 unmodified lines
modified:tests/models/test_queryparams.py+3 added
42 unmodified lines
43 assert QueryParams(q) == q444546def test_queryparam_types():47 q = QueryParams(None)48 assert str(q) == ""4950 q = QueryParams({"a": True})51 assert str(q) == "a=true"5253 q = QueryParams({"a": False})
34 unmodified lines