This commit is contained in:
2026-08-10 19:05:07 +08:00
parent 0e47719d5c
commit 5bcc7888c2
6 changed files with 14 additions and 15 deletions
@@ -98,14 +98,6 @@ class RequestEncryptMiddleware(BaseHTTPMiddleware):
status_code=response.status_code,
headers={"X-Encrypted": "true", "Content-Type": "application/json"},
)
except HTTPException as http_exc:
# BaseHTTPMiddleware 中 call_next 抛出的 HTTPException 会直接传播,
# 这里捕获后返回对应状态码的响应,避免被外层 except Exception 吞掉
return Response(
content=json.dumps({"detail": http_exc.detail}, ensure_ascii=False),
status_code=http_exc.status_code,
headers={"Content-Type": "application/json"},
)
except Exception:
logger.exception("Request decryption failed")
return Response(