Remove legacy hack

This commit is contained in:
Daniel García Aubert 2017-09-22 18:15:48 +02:00
parent ff19a8a2fe
commit 85d4c81e58
2 changed files with 3 additions and 1 deletions

View File

@ -27,11 +27,12 @@ var REQUEST_QUERY_PARAMS_WHITELIST = [
module.exports = function prepareContextMiddleware (authApi, pgConnection) {
return function prepareContext (req, res, next) {
var allowedQueryParams = REQUEST_QUERY_PARAMS_WHITELIST;
if (Array.isArray(req.context.allowedQueryParams)) {
allowedQueryParams = allowedQueryParams.concat(req.context.allowedQueryParams);
}
req.query = _.pick(req.query, allowedQueryParams);
req.params = _.extend({}, req.params); // shuffle things as request is a strange array/object
var user = req.context.user;

View File

@ -39,6 +39,7 @@ describe('prepare-context', function() {
done: function() {}
};
req.context = { user: 'localhost' };
req.params = {};
return req;
}