MCPcopy Create free account
hub / github.com/vercel/vercel / send_json_response

Function send_json_response

python/vercel-runtime/src/vercel_runtime/asgi.py:53–69  ·  view source on GitHub ↗
(
    send: Callable[[dict[str, Any]], Awaitable[None]],
    status_code: int,
    payload: dict[str, Any],
)

Source from the content-addressed store, hash-verified

51
52
53async def send_json_response(
54 send: Callable[[dict[str, Any]], Awaitable[None]],
55 status_code: int,
56 payload: dict[str, Any],
57) -> None:
58 body = json.dumps(payload, separators=(",", ":")).encode("utf-8")
59 await send(
60 {
61 "type": "http.response.start",
62 "status": status_code,
63 "headers": [
64 (b"content-type", b"application/json"),
65 (b"content-length", str(len(body)).encode("ascii")),
66 ],
67 }
68 )
69 await send({"type": "http.response.body", "body": body})

Callers 1

appFunction · 0.90

Calls 2

sendFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected