Core
Framework v2.x
2

getBodyBoolean #

Available since 2.11.0

Gets a parameter from the request body and checks that it is a boolean.

Contrary to other parameter types, an unset boolean does not trigger an error, instead it's considered as false

Arguments #

Copied to clipboard!
getBodyBoolean (name: string): boolean;

Name Type Description
name
string
Parameter name

Example #

Copied to clipboard!
const disabled = request.getBodyBoolean('disabled');
// equivalent
const disabled = request.input.body.disabled;
//+ checks to make sure that "disabled" is of the right type
// and throw standard API error when it's not the case