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

Function encode_json

httpx/_content.py:176–183  ·  view source on GitHub ↗
(json: Any)

Source from the content-addressed store, hash-verified

174
175
176def encode_json(json: Any) -> tuple[dict[str, str], ByteStream]:
177 body = json_dumps(
178 json, ensure_ascii=False, separators=(",", ":"), allow_nan=False
179 ).encode("utf-8")
180 content_length = str(len(body))
181 content_type = "application/json"
182 headers = {"Content-Length": content_length, "Content-Type": content_type}
183 return headers, ByteStream(body)
184
185
186def encode_request(

Callers 2

encode_requestFunction · 0.85
encode_responseFunction · 0.85

Calls 1

ByteStreamClass · 0.85

Tested by

no test coverage detected