Changelog
0.4.0 (May 4, 2014)
Adds support for Node v0.10.24 and up.
Adds the connection
event to Mitm to get the remote Net.Socket
. You can
use this to intercept and test any TCP code.
If you need the client side socket for any reason, listen to connect
on
Mitm.
Replaces the Http.ClientRequest
given to the request
event on Mitm with
a proper Http.IncomingMessage
— just like a regular Node server would
receive.
This ensures the requests you make are properly parseable according to HTTP
specs (assuming Node.js itself is implemented according to spec) and also lets
you assert on the content of POST
requests.
var mitm = Mitm()
Http.request({host: "x.org"}).end()
mitm.on("request", function(req) { req.headers.host.must.equal("x.org") })
Replaces Concert.js with Node's
EventEmitter for now as I was not sure the extra features were required.
Remember kids, if in doubt, leave it out.