Skip to content

Instantly share code, notes, and snippets.

@CyberLight
Forked from gcollazo/Backbone.sync_csrftoken.js
Last active August 29, 2015 14:17
Show Gist options
  • Save CyberLight/2459391cd1f81f23f0bd to your computer and use it in GitHub Desktop.
Save CyberLight/2459391cd1f81f23f0bd to your computer and use it in GitHub Desktop.
var oldSync = Backbone.sync;
Backbone.sync = function(method, model, options){
options.beforeSend = function(xhr){
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN);
};
return oldSync(method, model, options);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment