Use spread operator
This commit is contained in:
parent
0aa8d63a6e
commit
67d2d2fe95
@ -20,11 +20,7 @@ module.exports = function cleanUpQueryParamsMiddleware (customQueryParams = [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function cleanUpQueryParams (req, res, next) {
|
return function cleanUpQueryParams (req, res, next) {
|
||||||
var allowedQueryParams = REQUEST_QUERY_PARAMS_WHITELIST;
|
const allowedQueryParams = [...REQUEST_QUERY_PARAMS_WHITELIST, ...customQueryParams];
|
||||||
|
|
||||||
if (Array.isArray(customQueryParams)) {
|
|
||||||
allowedQueryParams = allowedQueryParams.concat(customQueryParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
req.query = _.pick(req.query, allowedQueryParams);
|
req.query = _.pick(req.query, allowedQueryParams);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user