sanic-org/sanic
ASGI exceptions outside handlers should be able to pass status
Aperta
#2718 aperta il 19 mar 2023
beginnerhelp wanted
Metriche repository
- Star
- (17.623 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
An exception raised in the lifecycle (but not handler) of a request on an ASGI-served application should be able to pass a status code.
In my experiment, raising a
BadRequestinasgi.pywill cause the ASGI server return 500 error, instead of 400. This seems out of the scope of this PR, but I am wondering whether we should change the raised error toServerErroror others before we figure out how to let ASGI server return a 400 error.
Originally posted by @ChihweiLHBird in https://github.com/sanic-org/sanic/pull/2606#discussion_r1133448078