Created
July 20, 2020 23:02
-
-
Save dongalor/4513610837a9ddd47b049d8518fbd00a to your computer and use it in GitHub Desktop.
CSRF FOR ALL THE XHR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var send = XMLHttpRequest.prototype.send, | |
token = $('meta[name=csrf-token]').attr('content'); | |
XMLHttpRequest.prototype.send = function(data) { | |
this.setRequestHeader('X-CSRF-Token', token); | |
return send.apply(this, arguments); | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment