Skip to content

Propagating events from EventEmmiter's that generate secondary events #9

@rbrtribeiro

Description

@rbrtribeiro

What is the expected behavior?
When propagating events from emitters such as http.ClientRequest (.e.g response), we should be able to listen for the secondary events (e.g. data event).

What is the actual behavior?
The response object seems to be empty, so, for instance, data event is not emitted.

Possible solution
In the propagate function, the new source.emit function should propagate the return value of emiting the event in the destination emitter. If not, the node http module will dump the object. As stated in the node _http_client.js source code:

If the user did not listen for the 'response' event, then they can't possibly read the data, so we ._dump() it into the void so that the socket doesn't hang there in a paused state.

If this interpretation is correct, PR submitted with a possible solution.

How to reproduce the issue
PR submitted with a new test case that reflects the issue.

Does the bug have a test case?
Submitted with PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions