MCPcopy
hub / github.com/encode/httpx / to_bytes

Function to_bytes

httpx/_utils.py:79–80  ·  httpx/_utils.py::to_bytes
(value: str | bytes, encoding: str = "utf-8")

Source from the content-addressed store, hash-verified

77
78
79def to_bytes(value: str | bytes, encoding: str = class="st">"utf-8") -> bytes:
80 return value.encode(encoding) if isinstance(value, str) else value
81
82
83def to_str(value: str | bytes, encoding: str = class="st">"utf-8") -> str:

Callers 6

_build_auth_headerMethod · 0.85
_build_auth_headerMethod · 0.85
__init__Method · 0.85
render_dataMethod · 0.85
get_lengthMethod · 0.85
render_dataMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected