middlewares/validator.js
// Check for invalid characters (regex, everything except letters, . _ [])
Check for invalid characters (regex, everything except letters, .
Check for invalid characters ( regex everything except letters .
function validateQueryParamContainsNoInvalidCharacters(queryParam) {
  const invalidCharacterIndex = queryParam.search(/[^a-zA-Z0-9.\s[\]_-]/);
  if (invalidCharacterIndex !== -1) {
    throw new ApiError.InvalidQueryParams(`Invalid character in query parameter '${queryParam}' at index = ${invalidCharacterIndex}: '${queryParam[invalidCharacterIndex]}'`);
  }
  logger.debug('Query parameter contains no invalid characters');
}
function validateQueryParamContainsNoInvalidCharacters ( queryParam ) { const invalidCharacterIndex = queryParam . search ( / [^a-zA-Z0-9.\s[\]_-] / ) ; if ( invalidCharacterIndex !== - 1 ) { throw new ApiError . InvalidQueryParams ( ` ${ queryParam } ${ invalidCharacterIndex } ${ queryParam [ invalidCharacterIndex ] } ` ) ; } logger . debug ( 'Query parameter contains no invalid characters' ) ; }
Check for invalid characters (regex, everything except letters, .
Check for invalid characters ( regex everything except letters .