Why is the check implemented this way?
if (payload !== undefined || state.reply.res.statusCode === 204) {
state.reply.send()
}
I would have expected it to be:
if (payload !== undefined || !state.reply.sent) {
state.reply.send(payload)
}
I'm mainly concerned because I have a reply decorator that does this:
and if I use that inside an async handler, reply.send() gets called twice.
Plus I feel like it would be a better developer experience to send an empty response if the developer doesn't call reply.send() inside a handler that resolves to undefined rather than letting the request hang.
Why is the check implemented this way?
I would have expected it to be:
I'm mainly concerned because I have a reply decorator that does this:
and if I use that inside an
asynchandler,reply.send()gets called twice.Plus I feel like it would be a better developer experience to send an empty response if the developer doesn't call
reply.send()inside a handler that resolves toundefinedrather than letting the request hang.