Skip to content

Fix/client disconnect as parsing error#9

Open
hbrooks wants to merge 3 commits into
masterfrom
demo/pr-15315
Open

Fix/client disconnect as parsing error#9
hbrooks wants to merge 3 commits into
masterfrom
demo/pr-15315

Conversation

@hbrooks
Copy link
Copy Markdown

@hbrooks hbrooks commented May 28, 2026

Originally PR fastapi#15315 in fastapi/fastapi by @AlePiccin

claude and others added 3 commits April 9, 2026 01:06
… parsing error

When a client disconnects while FastAPI is reading the request body,
Starlette raises ClientDisconnect. The broad `except Exception` handler
in the body reading code was catching this and converting it into
HTTPException(400, "There was an error parsing the body"), which is
misleading and hides the real cause.

Add `except ClientDisconnect: raise` before the catch-all so the
exception propagates correctly instead of being misclassified as a
parsing error.

https://claude.ai/code/session_01VuoZZMnmCx4FKbtkaUUPwJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants