update socket class with missing address method
See original GitHub issueContext
currently, I found nock and am trying to test out a http module flow. along the way, we require extracting the address()
result object.
w/in the response, we have this event:
req.on( 'socket', ( socket ) => {
console.log(socket);
req[ '_socketAddr' ] = socket.address();
} );
What are you trying to do and how would you want to do it differently? Is it something you currently you cannot do? Is this related to an issue/problem?
In the case of our tests, because the method doesn’t exist, the test throws an exception/error, which causes the test to fail.
Alternatives I’d love to know of alternatives: like could I assign a mock/stub socket to contain that address method?
Can you achieve the same result doing it in an alternative way? Is the alternative considerable?
Currently I know no way to make this happen
Has the feature been requested before?
I do no think so
If the feature request is accepted, would you be willing to submit a PR?
Yes, I can give it a whirl 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
The
options
param is meant to take the same values ashttp.request
, which already (optionally) takes a port and family. But I have mixed feelings about adding new options likeaddress
. Would it be wrong to just hardcode127.0.0.1
?Off the top of my head, something like this?
Docs for the new attrs too.
🎉 This issue has been resolved in version 11.7.0 🎉
The release is available on:
Your semantic-release bot 📦🚀