Closed mikicho closed 5 months ago
@kettanaito I fixed this as suggested. I still think we need to separate the socket-related logic from the HTTP-specific one if we want to support more protocols, but that can wait for another PR.
I have a couple of questions before it's ready for merge from my side:
Sharing our conversation from Discord:
That's tempting but I would recommend against it.
realSocket
introduces a state and I'd rather not have any state (or as little as possible state).Instead, we know the mocked and passthrough contexts because we have methods
respondWith()
andpassthrough()
. Those methods can set theaddress
function on the socket instance based on the context: