Refs #27083 -- Updated conditional header comparison to match RFC 7232.

This commit is contained in:
Kevin Christopher Henry 2016-09-12 23:26:24 -04:00 committed by Tim Graham
parent 5a51b44936
commit 22e303887b
5 changed files with 166 additions and 72 deletions

View file

@ -1,7 +1,7 @@
from django.http import HttpResponse
from django.views.decorators.http import condition, etag, last_modified
from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED
from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED, WEAK_ETAG
@condition(lambda r: ETAG, lambda r: LAST_MODIFIED)
@ -37,6 +37,14 @@ def etag_view_unquoted(request):
return HttpResponse(FULL_RESPONSE)
@condition(etag_func=lambda r: WEAK_ETAG)
def etag_view_weak(request):
"""
Use an etag_func() that returns a weak ETag.
"""
return HttpResponse(FULL_RESPONSE)
@condition(etag_func=lambda r: None)
def etag_view_none(request):
"""