Created
June 17, 2014 01:18
-
-
Save netroy/d21347ead2e44078840d to your computer and use it in GitHub Desktop.
Incercepting XHR & WebSockets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proto = WebSocket.prototype; | |
var send = proto.send; | |
Object.defineProperty(proto, 'send', { | |
'writable': false, | |
'value': function (data) { | |
console.log(data); | |
return send.apply(this, arguments); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proto = XMLHttpRequest.prototype; | |
var open = proto.open; | |
Object.defineProperty(proto, 'open', { | |
'writable': false, | |
'value': function (method, url) { | |
console.log(url); | |
return open.apply(this, arguments); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment