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) {
|
|
|
|
req.context.allowedQueryParams = params;
|
|
|
|
next();
|
|
|
|
};
|
|
|
|
};
|