Core
Framework v2.x
2

getBodyBoolean #

Available since 2.16.9

Gets a parameter from the request body and checks that it is a boolean. We also support lodash syntax. (relations.lebron[0])

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

Arguments #

getBodyBoolean (name: string): boolean;
NameTypeDescription
name
string
Parameter name

Example #

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