New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Reponse.has_body. #259
Conversation
Purpose of this property is to allow users to check if the Response has a body without forcing an evaulation of the underlying app_iter. This is handy if you wan't to create a streaming response where the app_iter itself is lazy (i.e. streams data over a socket) or the app_iter can only read once.
👍 |
This looks great. Just to bikeshed for a quick second... |
You have a point. It could indeed cause confusion if you only look at the property name (which is something I totally have done in the past). |
I'd be okay with the rename. I could see the confusion happening... |
|
I think I'm also fine with |
There is currently no checking if the user attempts to send a Response with an HTTP code that does not allow for a body. This is something that I may want to change in the future... I am okay with either one. |
This adds a change to stop WebOb from reading the entire `app_iter` when using the WebOb HTTP Exceptions. Closes #259
This is a result of the discussion in [https://github.com/Pylons/pyramid/issues/2625](Pyramid issue 2625).
Purpose of this property is to allow users to check if the
Response
has a body without forcing an evaulation of the underlyingapp_iter
. This is handy if you wan't to create a streaming response where theapp_iter
itself is lazy (i.e. streams data over a socket) or theapp_iter
can only read once.It's pretty much the same code as @bertjwregeer suggested but I added it as property rather than es method because I figured that it's fits better in the overall class design this way. The relevant changes for Pyramid will be done later.