MCPcopy Create free account
hub / github.com/dbunt1tled/python-fast-api / BodySave

Class BodySave

src/core/http/middleware/body_save.py:10–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class BodySave(BaseHTTPMiddleware):
11 def __init__(
12 self,
13 app: ASGIApp,
14 hash_service: HashService,
15 ) -> None:
16 super().__init__(app=app)
17 self.hash_service = hash_service
18
19 async def dispatch(self, request: Request, call_next: Callable) -> Response:
20 body = await request.body()
21 request_id = str(self.hash_service.uuid4())
22 request.state.request_id = request_id
23 request.state.body = body
24 return await call_next(request)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected