HttpRequest.getParamAs

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

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

Parameters

name string

The name of the URL parameter.

defaultValue T

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

Return Value

Type: T

The value of the URL parameter.