Error thrown from runHttpQuery results in "Headers have already sent." warning from moleculer-web
kthompson23 opened this issue · comments
Ken Thompson commented
When the catch handler in moleculerApollo.js
runs as a result of runHttpQuery
throwing an error, it sets the status code on the response and calls end
. Later in moleculer-web
when we hit the sendResponse
method, it logs a warning message "Headers have already sent." because response headers were already sent by moleculer-apollo
.
This isn't causing any issue other than additional noise in the logs.
Instead of calling res.end
in moleculerApollo.js
, if the error message and status code was returned it could be passed to service.sendResponse
and the error would be handled by moleculer-web
.
Icebob commented
Could you help about it with a PR?