on-headers
Last updated
Last updated
Execute a listener when a response is about to write headers.
This is a Node.js module available through the npm registry. Installation is done using the npm install
command:
This will add the listener listener
to fire when headers are emitted for res
. The listener is passed the response
object as it's context (this
). Headers are considered to be emitted only once, right before they are sent to the client.
When this is called multiple times on the same res
, the listener
s are fired in the reverse order they were added.