function urlencoded(options) {
    let { extended } = options;
    return function (req, res, next) {
        let contentType = req.headers['content-type'];
        if (contentType == "application/x-www-form-urlencoded") {
            let buffers = [];
            req.on('data', function (data) {
                buffers.push(data);
            });
            req.on('end', function () {
                let result = buffers.toString();//name=zfpx
                if (extended) {
                    //qs可以支持嵌套对象
                    req.body = qs.parse(result);
                } else {
                    req.body = querystring.parse(result);
                }
                next();
            });
        } else {
            next();
        }
    }
}
//with the querystring library (when false) or the qs library (when true). 
with the querystring library (when false) or the qs library (when true).
with the querystring library ( when false ) or the qs library ( when true ) .
function urlencoded(options) {
    let { extended } = options;
    return function (req, res, next) {
        let contentType = req.headers['content-type'];
        if (contentType == "application/x-www-form-urlencoded") {
            let buffers = [];
            req.on('data', function (data) {
                buffers.push(data);
            });
            req.on('end', function () {
                let result = buffers.toString();
                if (extended) {
                    req.body = qs.parse(result);
                } else {
                    req.body = querystring.parse(result);
                }
                next();
            });
        } else {
            next();
        }
    }
}
function urlencoded ( options ) { let { extended } = options ; return function ( req , res , next ) { let contentType = req . headers [ 'content-type' ] ; if ( contentType == "application/x-www-form-urlencoded" ) { let buffers = [ ] ; req . on ( 'data' , function ( data ) { buffers . push ( data ) ; } ) ; req . on ( 'end' , function ( ) { let result = buffers . toString ( ) ; if ( extended ) { req . body = qs . parse ( result ) ; } else { req . body = querystring . parse ( result ) ; } next ( ) ; } ) ; } else { next ( ) ; } } }
with the querystring library (when false) or the qs library (when true).
with the querystring library ( when false ) or the qs library ( when true ) .
//name=zfpx //qs可以支持嵌套对象