mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
added setting and code to turn off extra CSRF checking for unsafe actions
This commit is contained in:
parent
e429f702e0
commit
d2e12c293b
|
@ -290,6 +290,12 @@ else:
|
|||
)
|
||||
return self._reject(request, REASON_NO_CSRF_COOKIE)
|
||||
|
||||
if hasattr(settings, 'REST_FRAMEWORK_EXTRA_CSRF'):
|
||||
extra_csrf = settings.REST_FRAMEWORK_EXTRA_CSRF
|
||||
else:
|
||||
extra_csrf = True
|
||||
|
||||
if extra_csrf:
|
||||
# check non-cookie token for match
|
||||
request_csrf_token = ""
|
||||
if request.method == "POST":
|
||||
|
|
Loading…
Reference in New Issue
Block a user