Skip to content

Instantly share code, notes, and snippets.

@toriato
Created July 7, 2021 21:26
Show Gist options
  • Save toriato/29dbc070c3c2f7ff71e44321e2019a01 to your computer and use it in GitHub Desktop.
Save toriato/29dbc070c3c2f7ff71e44321e2019a01 to your computer and use it in GitHub Desktop.
XMLHttpRequest.prototype._open = XMLHttpRequest.prototype.open
XMLHttpRequest.prototype._send = XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.open = function () {
/* codes... */
this.hooked = true
console.log(...arguments)
return this._open(...arguments)
}
XMLHttpRequest.prototype.send = function () {
if (this.hooked === true) {
console.log(...arguments)
}
return this._open(...arguments)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment