Skip to content
Discussion options

You must be logged in to vote

Hello @SailorMax,

Few things to cover. This issue actually stems from Starlette’s HTTP middleware: it creates a cached copy of the request by wrapping the ASGI receive function, but it doesn’t handle some cases where the middleware itself consumes the stream (for example, via await request.form()). Once that stream is drained, downstream handlers have nothing left to read.
Starlette discourages and may eventually stop supporting the use of this HTTP middleware, so this form-consumption case is unlikely to be fixed upstream.

if uncomment "print(await request.body())" in authorization() - the problem will gone.

in your authorization() middleware, you force Starlette to read and cache the …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants