I'm implementing a "recording" mode in my testing lib where it would be really useful to know the
originally intended host/port/etc. of the intercepted connection, which were passed as the second parameter to the connect listeners. Right now I can either try to get the host and port number from the Host header, which might not be the correct value, or I can have listeners for both the connect and request events and try to pair them up, which also seems like a fool's errand as they aren't necessarily one-to-one when keep-alive is in play.
Would it be possible to pass the connect opts as the third parameter to the request listeners?
Properly mocking out {req,res}.socket.{remote,local}{Family,Address,Port} would also be really nice, but even if they were, it would be nice to have the original, non-resolved host available.
I'm implementing a "recording" mode in my testing lib where it would be really useful to know the
originally intended host/port/etc. of the intercepted connection, which were passed as the second parameter to the
connectlisteners. Right now I can either try to get the host and port number from theHostheader, which might not be the correct value, or I can have listeners for both theconnectandrequestevents and try to pair them up, which also seems like a fool's errand as they aren't necessarily one-to-one when keep-alive is in play.Would it be possible to pass the connect opts as the third parameter to the
requestlisteners?Properly mocking out {req,res}.socket.{remote,local}{Family,Address,Port} would also be really nice, but even if they were, it would be nice to have the original, non-resolved
hostavailable.