validateQuery function

RequestHandler validateQuery(
  1. Validator validator,
  2. {String errorMessage = 'Invalid data.'}

Validates the data in req.queryParameters, and sets the query to filtered data before continuing the response.


RequestHandler validateQuery(Validator validator, {String errorMessage = 'Invalid data.'}) {
  return (RequestContext req, res) async {
    var result = await asyncApplyValidator(validator, req.queryParameters,;

    if (result.errors.isNotEmpty) {
      throw GalileoHttpException.badRequest(message: errorMessage, errors: result.errors);


    return true;