mitm-papandreou
Version:
Intercept and mock outgoing network TCP connections and HTTP requests for testing. Intercepts and gives you a Net.Socket, Http.IncomingMessage and Http.ServerResponse to test and respond with. Useful when testing code that hits remote servers.
13 lines (9 loc) • 300 B
JavaScript
var Net = require("net")
module.exports = Socket
function Socket() { Net.Socket.apply(this, arguments) }
Socket.prototype = Object.create(Net.Socket.prototype, {
constructor: {value: Socket, configurable: true, writeable: true}
})
Socket.prototype.bypass = function() {
this.bypassed = true
}