Skip to content

Instantly share code, notes, and snippets.

@dewdad
Created February 5, 2014 18:43
Show Gist options
  • Save dewdad/8830348 to your computer and use it in GitHub Desktop.
Save dewdad/8830348 to your computer and use it in GitHub Desktop.
Overriding xmlhttprequest open to tamper with requests in JavaScript apps From http://stackoverflow.com/questions/7775767/javascript-overriding-xmlhttprequest-open
(function() {
var proxied = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function() {
console.log( arguments );
return proxied.apply(this, [].slice.call(arguments));
};
})();
/*
["POST", "/ajax/chat/buddy_list.php?__a=1", true]
["POST", "/ajax/apps/usage_update.php?__a=1", true]
["POST", "/ajax/chat/buddy_list.php?__a=1", true]
["POST", "/ajax/canvas_ticker.php?__a=1", true]
["POST", "/ajax/canvas_ticker.php?__a=1", true]
["POST", "/ajax/chat/buddy_list.php?__a=1", true]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment