Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save a3linux/11204512 to your computer and use it in GitHub Desktop.

Select an option

Save a3linux/11204512 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