1

I have an endpoint in my Flask application that accepts large data as the content. I would like to ensure that Flask never attempts to process this body, regardless of its content-type, and always ensures I can read it with the Rquest.stream interface.

This applies only to a couple of endpoints, not my entire application.

How can I configure this?

1 Answer 1

2

The Werkzeug Request object heavily relies on properties and anything that touches request data is lazily cached; e.g. only when you actually access the .form attribute would any parsing take place, with the result cached.

In other words, don't touch .files, .form, .get_data(), etc. and nothing will be sucked into memory either.

Sign up to request clarification or add additional context in comments.

1 Comment

I started using stream and don't appear to have any problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.