Dont' require IF_MATCH header

The HTTP RFC doesn't require the IF_MATCH header and it's language on
what to do when it's not included isn't absolute so removing this check.

The implementing codebase can easily add this by overriding
precondition_check in ETagCacheLookup if necessary.
This commit is contained in:
George Hickman 2013-04-02 12:28:58 +01:00
parent 879302c815
commit 2139c109ab
2 changed files with 0 additions and 21 deletions

View File

@ -96,14 +96,6 @@ class PreconditionFailed(APIException):
self.detail = detail or self.default_detail self.detail = detail or self.default_detail
class IfMatchMissing(APIException):
default_detail = 'IF_MATCH header is required'
status_code = status.HTTP_400_BAD_REQUEST
def __init__(self, detail=None):
self.detail = detail or self.default_detail
class ConfigurationError(Exception): class ConfigurationError(Exception):
""" """
Indicates an internal server error. Indicates an internal server error.

View File

@ -313,15 +313,6 @@ class APIView(View):
headers.update(cache_lookup.get_response_header(obj)) headers.update(cache_lookup.get_response_header(obj))
return headers return headers
def check_update_validity(self, request):
"""
"""
# TODO add setting to cover
# * raise IfMatchMissing when it's missing (if it's there, carry on)
# * continue regardless
if request.META.get('HTTP_IF_MATCH') is None:
raise exceptions.IfMatchMissing
def cache_precondition_check(self, obj, request): def cache_precondition_check(self, obj, request):
for cache_lookup in self.get_cache_lookups(): for cache_lookup in self.get_cache_lookups():
cache_lookup.precondition_check(obj, request) cache_lookup.precondition_check(obj, request)
@ -430,10 +421,6 @@ class APIView(View):
else: else:
handler = self.http_method_not_allowed handler = self.http_method_not_allowed
if request.method.lower() in ('put', 'delete'):
# FIXME this method name isn't obvious
self.check_update_validity(request)
response = handler(request, *args, **kwargs) response = handler(request, *args, **kwargs)
except Exception as exc: except Exception as exc: