I want to manually create http.IncomingMessage stream with some header & body. As it is a readable stream, I can't write/pipe data into it. Is it safe to extend it?
Also, I am not sure how to store headers when it's a stream which doesn't operate on ObjectMode.
EDIT:
According to Node.js documentation, extending http.IncomingMessage is possible.
IncomingMessage <http.IncomingMessage> Specifies the IncomingMessage class to be used. Useful for extending the original IncomingMessage. Default: IncomingMessage.
How can I extend it? Its constructor asks for Socket object.