You can clone with
There is an issue with the class EmptyResponse of response.py (line 1221).
The first if in the constructor is formulated like this:
if app_iter and hasattr(app_iter, 'close'):
And should be more likely something like:
if app_iter is not None and hasattr(app_iter, 'close'):
The bug I encounter is that my main application uses the close method, and I have at least two middlewares using WebOb in my WSGI stack. Now when a HEAD request occurs, WebOb returns this EmptyResponse iterator instead of the one of the application, still mapping the close method of the original iterator to this new one. However it defines as well the __len__ method to return zero. Now if you have two middlewares using WebOb, the first middleware will replace the application iterator with this EmptyResponse, and the second will do the same thing, however the if used to map the close method will fail (because of the __len__ method), and the close method of the application will never be mapped, and called.
This bug is really a blocking point for me, and I would greatly appreciate to have it fixed quickly.
I understand the issue, but please provide a test case to reproduce this.