HttpRequest.getHeaderAs

Gets a header as the specified type, or returns the default value if the header with the given name doesn't exist or is of an invalid format.

struct HttpRequest
const
T
getHeaderAs
(
T
)
(
string name
,
T defaultValue = T.init
)

Parameters

name string

The name of the header, case-sensitive.

defaultValue T

The default value to return if the header doesn't exist.

Return Value

Type: T

The value of the header as the specified type.