mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Update csrf.js
improved comment readability
This commit is contained in:
parent
cdc956a96c
commit
7c895c0b45
|
@ -43,9 +43,8 @@ var csrftoken = window.drf.csrfToken;
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {
|
if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {
|
||||||
// Send the token to same-origin, relative URLs only.
|
/* Send the token to same-origin, relative URLs only.
|
||||||
// Send the token only if the method warrants CSRF protection
|
Send the token only if the method warrants CSRF protection using the CSRFToken value acquired earlier*/
|
||||||
// Using the CSRFToken value acquired earlier
|
|
||||||
xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken);
|
xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user