Response
Utilties to send response headers and data.
setResponseHeader
Set the value of outgoing response header
Parameter | Type | Description |
---|---|---|
event | H4Event | An H4Event instance containing the HTTP request |
header | String | The header name to set |
value | String | Value to assign to the header |
Behavior:
- Sets header if not already present
- Adds header value with warning if header exists
- Example: Setting JSON content type
getResponseHeaders
Get the outgoing response headers
Returns:
HttpHeaders
object or null
if response unavailable
Example:
getResponseHeader
Retrieve specific header value from response
Parameters:
event
:H4Event
containing request contextheader
: Name of header to retrieve
Returns: Header value as String
or null
if not found