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

Function add_request_id

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected