Core
Framework v2.x
2

getBodyArray #

Available since 2.16.9

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

Arguments #

getBodyArray (name: string, def: [] = null): any[]
NameTypeDescription
name
string
Parameter name
def
array
Default value to return if the parameter is not set

Example #

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