MCPcopy Create free account
hub / github.com/Roy3838/Observer / add_request_id

Function add_request_id

api/api.py:112–120  ·  view source on GitHub ↗
(request: Request, call_next)

Source from the content-addressed store, hash-verified

110# indistinguishable from everyone else's.
111@app.middleware("http")
112async def add_request_id(request: Request, call_next):
113 request_id = request.headers.get("x-request-id") or uuid.uuid4().hex[:12]
114 token = request_id_var.set(request_id)
115 try:
116 response = await call_next(request)
117 response.headers["X-Request-ID"] = request_id
118 return response
119 finally:
120 request_id_var.reset(token)
121
122# Reject oversized request bodies before they are read into memory
123@app.middleware("http")

Callers

nothing calls this directly

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected