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

Function encode_text

httpx/_content.py:160–165  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

158
159
160def encode_text(text: str) -> tuple[dict[str, str], ByteStream]:
161 body = text.encode("utf-8")
162 content_length = str(len(body))
163 content_type = "text/plain; charset=utf-8"
164 headers = {"Content-Length": content_length, "Content-Type": content_type}
165 return headers, ByteStream(body)
166
167
168def encode_html(html: str) -> tuple[dict[str, str], ByteStream]:

Callers 1

encode_responseFunction · 0.85

Calls 1

ByteStreamClass · 0.85

Tested by

no test coverage detected