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

Function to_str

httpx/_utils.py:83–84  ·  httpx/_utils.py::to_str
(value: str | bytes, encoding: str = "utf-8")

Source from the content-addressed store, hash-verified

81
82
83def to_str(value: str | bytes, encoding: str = class="st">"utf-8") -> str:
84 return value if isinstance(value, str) else value.decode(encoding)
85
86
87def to_bytes_or_str(value: str, match_type_of: typing.AnyStr) -> typing.AnyStr:

Callers 2

_get_header_valueMethod · 0.85

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected