2017-03-31 02:12:55 +08:00
|
|
|
module.exports = function allowQueryParams(params) {
|
2017-04-01 00:39:29 +08:00
|
|
|
if (!Array.isArray(params)) {
|
|
|
|
throw new Error('allowQueryParams must receive an Array of params');
|
|
|
|
}
|
2017-03-31 02:12:55 +08:00
|
|
|
return function allowQueryParamsMiddleware(req, res, next) {
|
2017-10-03 23:47:57 +08:00
|
|
|
res.locals.allowedQueryParams = params;
|
2017-03-31 02:12:55 +08:00
|
|
|
next();
|
|
|
|
};
|
|
|
|
};
|