Closed giovanni-bertoncelli closed 2 years ago
Great, thanks!
@icebob maybe the call should be always resolved instead of rejected since if rejected moleculer tries to write the headers, but since the response stream has already started the headers are surely already been written. Which approach do you prefer?
Can we check that the response stream is started? And in this case, we block the header sending.
@icebob how can we do that? By resolving if headersSent
is true
? And rejecting otherwise?
(BTW @michelevincenzi is my colleague, we're working together on this)
we can reject, but check the headersSent
value in sendError
.
Resolves #298. Added handlers to handle
error
andclose
events on response and resolve/reject respectively the context caller.