const _ = require('lodash');

// 黑名单参数
const BLACK_LIST = [
    'client_secret',
    'method',
    'openby:yohobuy'
];

module.exports = () => {
    return (req, res, next) => {
        if (req.query) {
            _.forEach(BLACK_LIST, (key) => {
                if (key === 'client_secret') {
                    req.yoho.client_secret = req.query[key];
                }

                if (req.query[key]) {
                    delete req.query[key];
                }
            });
        }

        next();
    };
};