Checklist
Steps to reproduce
- Install Django and Django REST Framework as per the instructions in the quickstart
- Set
CSRF_USE_SESSIONS = True in settings
- Navigate to
/users/ and create a new user using "Post"
- Click "Put" to update the user
Expected behavior
The PUT request is accepted
Actual behavior
Django returns a 403 and indicates a CSRF failure
Additional Information
When using session-based CSRF, no cookie is sent to the browser. For any unsafe method except POST, the CSRF token is not in the form, and even if it is included Django ignores it if the method is not POST (see CsrfViewMiddleware.process_view()).
Checklist
masterbranch of Django REST framework.Steps to reproduce
CSRF_USE_SESSIONS = Truein settings/users/and create a new user using "Post"Expected behavior
The
PUTrequest is acceptedActual behavior
Django returns a 403 and indicates a CSRF failure
Additional Information
When using session-based CSRF, no cookie is sent to the browser. For any unsafe method except
POST, the CSRF token is not in the form, and even if it is included Django ignores it if the method is notPOST(seeCsrfViewMiddleware.process_view()).