Passing a stream into EnvironBuilder.get_environ()
#2844
Unanswered
AbdealiLoKo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was using
werkzeug.test.EnvironBuilder.get_environ()and realized that when I gave a pretty large file, this function was taking a fair amount of RAM.I was assuming that it would simply take the
input_streamand pass it to the other side.I then realized that when I give a
input_streamandcontent_lengththe function was still reading the entire stream into RAM, and then re-calculating thecontent_lengthReference:
https://github.com/pallets/werkzeug/blob/3.0.1/src/werkzeug/test.py#L681-L686
Is there a more optimal way for me to simply provide the
content_lengthandinput_streamso that werkzeug takes my values instead of reading the entire stream into RAM ?Beta Was this translation helpful? Give feedback.
All reactions