Throw on invalid params argument

This commit is contained in:
Raul Ochoa 2017-03-31 18:39:29 +02:00
parent 94299f0452
commit ededc73fd7

View File

@ -1,4 +1,7 @@
module.exports = function allowQueryParams(params) {
if (!Array.isArray(params)) {
throw new Error('allowQueryParams must receive an Array of params');
}
return function allowQueryParamsMiddleware(req, res, next) {
req.context.allowedQueryParams = params;
next();