ConditionalGetMiddleware doesn't set response code properly
|Reported by:||DOP||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Just noticed that If-None-Match request doesn't really work even though ConditionalGetMiddleware is enabled and the response has ETag matching If-None-Match header in the request.
This is from django/middleware/http.py:
if response.has_header('ETag'): if_none_match = request.META.get('HTTP_IF_NONE_MATCH', None) if if_none_match == response['ETag']: ... response.status = 304 if response.has_header('Last-Modified'): if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE', None) if if_modified_since == response['Last-Modified']: ... response.status = 304
Shouldn't it be response.status_code = 304?