Closed
Description
As a developer I want to access the current state of the response inside the Middleware to execute code after the execution of the handler if needed.
The InternalResponse
class should expose a on
method that will require the event to subscribe and the listener function.
The events can be:
beforeSend
. Event triggered before the response has sent the datadata
. Event triggered when the data has been sent.afterSend
. Event triggered when the data has been sent but the response has not been closed.close
. Event triggered when the response and the connection has been closed.redirect
. Event triggered when the handler is redirecting to a new path.error
. Event triggered when an error has been thrown.all
. Wildcard for all the events.
The listener should accept a parameter that is the event which triggered it.
The stream should be broadcast to ensure that more listener can listen to the same event.
Metadata
Assignees
Labels
Projects
Status
Closed