Title pretty much sums it up, I am trying to intercept a web request and get the request headers.
This is what I tried:
let oldSend = XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.send = function() {
console.log(this.responseHeaders);
return oldSend.apply(this, arguments);
}
This is what I expect:
{"test":"abcd1234"}
on PHP
<?php
header('Test 123 I Love Bacon'); // just to test header_ list
var_dump(headers_list()); // show headers to be sent by the browser
?>