Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit c0b424f

Browse files
committed
fix: 分行输出 422 错误详情以避免请求体截断
1 parent 41a59ef commit c0b424f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ async def lifespan(app: FastAPI):
8484

8585
@APP.exception_handler(RequestValidationError)
8686
async def validation_exception_handler(request: Request, exc: RequestValidationError):
87-
# Log the 422 error details
88-
log.debug(
89-
f"Invalid request on {request.url}: {exc}. Request body: {exc.body}"
90-
)
87+
# Log the 422 error details, 分行输出避免 Request body 截断
88+
log.debug(f"Invalid request on {request.url} Detail: {exc}")
89+
log.debug(f"Invalid request on {request.url} Request body: {exc.body}")
9190
return await request_validation_exception_handler(request, exc)
9291

9392

0 commit comments

Comments
 (0)