Skip to content

header

Gets or sets HTTP headers in the current request or response.

Syntax

js
const value = header('x-custom-header')
header('x-new-header', 'abc123')

Usage

  • Reading: header('x') returns a header value from the request.
  • Writing: header('x', 'y') sets a header on the response.

Example

js
const userAgent = header('user-agent')
header('x-backend-version', '1.32.42')