mirror of
https://github.com/django/django.git
synced 2025-10-17 13:58:24 +00:00
Refs #27083 -- Updated conditional header comparison to match RFC 7232.
This commit is contained in:
parent
5a51b44936
commit
22e303887b
5 changed files with 166 additions and 72 deletions
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue