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
Seems WebOb 1.7 has some glitches with WebTest when a 204 is responded #305
Comments
Thanks for the report @amol- It may be that if there is an |
digitalresistor
added a commit
that referenced
this issue
Jan 17, 2017
digitalresistor
added a commit
that referenced
this issue
Jan 17, 2017
digitalresistor
added a commit
that referenced
this issue
Jan 17, 2017
digitalresistor
added a commit
that referenced
this issue
Jan 17, 2017
I have added a test and |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The recent WebOb 1.7 changes to initialisation function seem to had introduced a side effect when WebTest is used, as webtest will recreate a new
Response
object from the application response.A simple testcase can be created to showcase the issue:
The snippet is meant to work on both 1.6 and 1.7, so it adds some unnecessary values like
body
andcontent_type
which are already provided in 1.7 (those values are in fact a nop on 1.7) while they are required on 1.6 to generate a response without content.The response is as expected both on 1.6 and 1.7
Creating a plain webtest
TestApp
from the previous example:will issue a validation error on WebOb 1.7:
while it will work without the error with WebOb 1.6.
This seems to be related to 35fd585 as https://github.com/Pylons/webob/blob/master/webob/response.py#L323 throws away the webtest
IteratorWrapper
injected by WebTest replacing it with[b'']
ascode_has_body
is False and thus breakingWebTest
I wouldn't take for granted that if there is an
app_iter
it will be wrong and needs to be discarded as response has no content. It's probably a right assumption in the case ofbody
, but discardingapp_iter
might in fact break some application by discarding an iterator which returns an empty response too but has other side effects.The text was updated successfully, but these errors were encountered: