diff --git a/backend/app/core/operation.py b/backend/app/core/operation.py index 05011d8..e49a8a9 100644 --- a/backend/app/core/operation.py +++ b/backend/app/core/operation.py @@ -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,11 +26,10 @@ class LoggingMiddleware(BaseHTTPMiddleware): await self.log_error(request, e) raise - await self.log_request(request, response,state) - else: - response = await call_next(request) - - return response + if hasattr(request.state, "user") and hasattr(request.state, "tenant"): + await self.log_request(request, response,state) + + return response async def log_request(self, request: Request, response,state): try: