Skip to content

Instantly share code, notes, and snippets.

@dunmaksim
Last active September 26, 2017 17:24
Show Gist options
  • Save dunmaksim/991f534c9318c3fef650d87927a7350c to your computer and use it in GitHub Desktop.
Save dunmaksim/991f534c9318c3fef650d87927a7350c to your computer and use it in GitHub Desktop.
Dojo Toolkit with CSRF Token from cookies at any request
require([
"dojo/request/notify",
"dojo/cookie",
"dojo/domReady!"
], function (notify, cookie) {
notify("send", function (response, cancel) {
response.xhr.setRequestHeader('X-CSRFToken', cookie("csrftoken"));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment