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

Function echo_headers

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

Source from the content-addressed store, hash-verified

161
162
163async def echo_headers(scope: Scope, receive: Receive, send: Send) -> None:
164 body = {
165 name.capitalize().decode(): value.decode()
166 for name, value in scope.get("headers", [])
167 }
168 await send(
169 {
170 "type": "http.response.start",
171 "status": 200,
172 "headers": [[b"content-type", b"application/json"]],
173 }
174 )
175 await send({"type": "http.response.body", "body": json.dumps(body).encode()})
176
177
178async def redirect_301(scope: Scope, receive: Receive, send: Send) -> None:

Callers 1

appFunction · 0.70

Calls 2

decodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected