Skip to content

Instantly share code, notes, and snippets.

@bencmbrook
Created August 14, 2019 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bencmbrook/2fdafbb96665d6c41725803eeb42510b to your computer and use it in GitHub Desktop.
Save bencmbrook/2fdafbb96665d6c41725803eeb42510b to your computer and use it in GitHub Desktop.
Log XHR URLs on your site to build a CSP
(function(XHR) {
var open = XHR.prototype.open;
var send = XHR.prototype.send;
XHR.prototype.open = function(method, url, async, user, pass) {
this._url = url;
open.call(this, method, url, async, user, pass);
};
XHR.prototype.send = function(data) {
var url = this._url;
console.log(url);
send.call(this, data);
}
})(XMLHttpRequest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment