Closed LoadingZhang closed 1 month ago
I'm not sure I understood your question / problem but _body
is a private attribute that you should not be accessing or interacting with. Maybe try await request.body()
?
I'm not sure I understood your question / problem but
_body
is a private attribute that you should not be accessing or interacting with. Maybe tryawait request.body()
?
@adriangb I used await request.body()
before, but it raised an error:
raise RuntimeError("Stream consumed")
RuntimeError: Stream consumed
After investigation, I found out that _body
was missing and _stream_consumed
is True after middleware processed.
And I discovered similar topic in the discussion, which might be related. https://github.com/encode/starlette/discussions/2556
Let's continue the discussion there then.
This doesn't seem an issue, also the script on the description is using private attributes that shouldn't be used to demonstrate an issue.
I want to save request to ContextVar so I can use it anywhere. Here is code sample:
Output:
so, my question is