bugfix LoggingMiddleware

This commit is contained in:
2025-02-01 14:43:22 +09:00
parent b502a3ba8f
commit af959469de

View File

@@ -11,7 +11,6 @@ import json
class LoggingMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
if hasattr(request.state, "user") and hasattr(request.state, "tenant"):
if request.method in ("POST", "PUT", "PATCH","DELETE"):
try:
request.state.body = await request.json()
@@ -27,9 +26,8 @@ class LoggingMiddleware(BaseHTTPMiddleware):
await self.log_error(request, e)
raise
if hasattr(request.state, "user") and hasattr(request.state, "tenant"):
await self.log_request(request, response,state)
else:
response = await call_next(request)
return response