Skip to content

Commit a3cc360

Browse files
authored
docs: add note about server behavior on exceptions (#2535)
1 parent 6725ebb commit a3cc360

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/server-behavior.md

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Server errors will be logged at the `error` log level. All logging defaults to b
8383

8484
If an exception is raised by an ASGI application, and a response has not yet been sent on the connection, then a `500 Server Error` HTTP response will be sent.
8585

86+
Uvicorn sends the headers and the status code as soon as it receives from the ASGI application. This means that if the application sends a [Response Start](https://asgi.readthedocs.io/en/latest/specs/www.html#response-start-send-event)
87+
message with a status code of `200 OK`, and then an exception is raised, the response will still be sent with a status code of `200 OK`.
88+
8689
### Invalid responses
8790

8891
Uvicorn will ensure that ASGI applications send the correct sequence of messages, and will raise errors otherwise. This includes checking for no response sent, partial response sent, or invalid message sequences being sent.

0 commit comments

Comments
 (0)