Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you intercept xhr POST parameters / POST body?

I know how to intercept AJAX calls with XMLHttpRequest.

I looked at the docs and there is no mentioning of the parameters (POST body) .

How do I intercept those using XMLHttpRequest.

I'm trying to keep track of all the AJAX requests run on a web page.

Thanks!

like image 546
Tal Cohen Avatar asked Oct 12 '25 21:10

Tal Cohen


1 Answers

This is how you do it:

XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send; 
var newSend = function(vData) { console.log("data: " + vData); this.realSend(vData); };
XMLHttpRequest.prototype.send = newSend;
like image 113
Tal Cohen Avatar answered Oct 14 '25 09:10

Tal Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!