Skip to content
Myr

Refactoring of models api (#1284)

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

* Made Request.prepare private (i.e. renamed it to _prepare) * Added bytes as a new possible QueryParamTypes

authored by cdeler · committed by GitHub · parent b58bd8e · Browse files · 2 files+5 added−3 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+5 added−3 removed

  • other:+5 added−3 removed

2 files+5 added−3 removed

modified:httpx/_models.py+4 added-3 removed
240 unmodified lines
241242 value = args[0] if args else kwargs243244 items: typing.Sequence[typing.Tuple[str, PrimitiveData]]245 if value is None or isinstance(value, str):245 if value is None or isinstance(value, (str, bytes)):246 value = value.decode("ascii") if isinstance(value, bytes) else value247 items = parse_qsl(value)248 elif isinstance(value, QueryParams):249 items = value.multi_items()250 elif isinstance(value, list):
355 unmodified lines
606 self.stream = stream607 else:608 self.stream = encode(data, files, json)609609 self.prepare()610 self._prepare()611611 def prepare(self) -> None:612 def _prepare(self) -> None:613 for key, value in self.stream.get_headers().items():614 # Ignore Transfer-Encoding if the Content-Length has been set explicitly.615 if key.lower() == "transfer-encoding" and "content-length" in self.headers:616 continue
641 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 bytes,38 None,39]4041HeaderTypes = Union[
39 unmodified lines