I'm trying to log (and later modify) the data XMLHttpRequest
sends to a server by overriding XMLHttpRequest.send
function.
My function logs the data correctly to the console, however the request doesn't finish, therefore the browser keeps waiting for the response indefinitely.
Any ideas what's wrong with the code?
XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
var newSend = function(vData) { console.log("data: " + vData); realSend(vData); };
XMLHttpRequest.prototype.send = newSend;