faassen/bowerstatic

304 causes exception and 500 to be returned

Opened this issue · 1 comments

When IF-MODIFIED-SINCE HTTP header causes WebOb to set a 304 status code, bowerstatic as a tween causes an error because it tries to check the content. When it does so, it raises an exception which turns into a 500 instead of the 304. The 304 is supposed to be returned to the browser.

injector.py:

if response.content_type.lower() not in CONTENT_TYPES:

This throws an an exception.

AttributeError: 'NoneType' object has no attribute 'lower'

response.content_type has been set to empty since a 304 doesn't return content. I think if call sees a 304 it should just immediately return response.

+1. Care to come up with a pull request for this (with a test for this scenario)?