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

Function echo_body

tests/conftest.py:125–141  ·  view source on GitHub ↗
(scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

123
124
125async def echo_body(scope: Scope, receive: Receive, send: Send) -> None:
126 body = b""
127 more_body = True
128
129 while more_body:
130 message = await receive()
131 body += message.get("body", b"")
132 more_body = message.get("more_body", False)
133
134 await send(
135 {
136 "type": "http.response.start",
137 "status": 200,
138 "headers": [[b"content-type", b"text/plain"]],
139 }
140 )
141 await send({"type": "http.response.body", "body": body})
142
143
144async def echo_binary(scope: Scope, receive: Receive, send: Send) -> None:

Callers 1

appFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected