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

Function echo_headers

tests/test_asgi.py:48–56  ·  view source on GitHub ↗
(scope, receive, send)

Source from the content-addressed store, hash-verified

46
47
48async def echo_headers(scope, receive, send):
49 status = 200
50 output = json.dumps(
51 {"headers": [[k.decode(), v.decode()] for k, v in scope["headers"]]}
52 ).encode("utf-8")
53 headers = [(b"content-type", "text/plain"), (b"content-length", str(len(output)))]
54
55 await send({"type": "http.response.start", "status": status, "headers": headers})
56 await send({"type": "http.response.body", "body": output})
57
58
59async def raise_exc(scope, receive, send):

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected