• This project
    • Loading...
  • Sign in

fe / yohobuywap-node · Files

Go to a project

GitLab

  • Go to group
  • Project
  • Activity
  • Files
  • Commits
  • Pipelines 0
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Members
  • Labels
  • Wiki
  • Forks
  • Network
  • Create a new issue
  • yohobuywap-node
  • doraemon
  • middleware
  • req-params-filter.js
  • 参数黑名单过滤
    d60215a8
    by 徐炜
    2016-12-07 14:49:01 +0800  
    Browse Directory »
req-params-filter.js 388 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
const _ = require('lodash');

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

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

        next();
    };
};