You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
471 B

/**
* Take the layers specified by the layers parameter and use them to set the
* list of Elasticsearch types to filter.
*
* This has to be done outside the layers sanitizer since it doesn't know that
* the layers property is eventualy used to choose the _type.
*/
function middleware(req, res, next) {
req.clean = req.clean || {};
if (req.clean.hasOwnProperty('layers')) {
req.clean.type = req.clean.layers;
}
next();
}
module.exports = middleware;