moll / node-mitm

Intercept and mock outgoing Node.js 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. Super useful when testing code that hits remote servers.
Other
641 stars 48 forks source link

HTTPS flag? #10

Closed alexkwolfe closed 9 years ago

alexkwolfe commented 9 years ago

The readme says "Please note that HTTPS requests are currently "morphed" into HTTP requests. That's to save us from having to set up certificates and disable their verification."

Could you conceivably add a flag to the request object that would indicate that the protocol was https?

holic commented 9 years ago

:+1:

papandreou commented 9 years ago

Just ran into this as well. I recommend req.{connection,socket}.encrypted like node.js itself uses.

vvo commented 9 years ago

:+1: @moll Do you think we can merge this?

moll commented 9 years ago

Hey! Late to party as always. :innocent:

Thanks for the suggestion! I combined your and @papandreou's proposal with using the actual Tls.TLSSocket. Now, both the client side socket and the server side socket should be instances of TLSSockets with the encrypted and authorized flags set. Underneath they're still plain Net.Socket objects.

Anywho, all that's in v1.1.0 available from any well stocked retail store near you.

holic commented 9 years ago

Thanks @moll !