Home  >  Q&A  >  body text

node.js - node发post请求参数过长

request.post( urlstr )
    .set('Content-Type', 'application/x-www-form-urlencoded')
    .send(da)
    .end(function(err, res){
        if (!err) {
            console.log(res.body)
            callback(res.body);
        }else{

        };
        
    })
if (this.config.obj.productInfo) {
        this.config.obj.productInfo =  encodeURI( this.config.obj.productInfo );
    };
    var bodyQueryStr = this.config.obj;
    

    var da = '';

    for (var a in bodyQueryStr) {
        da += a +'='+ bodyQueryStr[a] + '&';
    };

使用SuperAgent发post请求 当参数过长时 失效了 什么原因呢 和 application/x-www-form-urlencoded 有关系吗

大家讲道理大家讲道理2719 days ago682

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-17 15:29:28

    What about splitting an object into multiple single key-value pairs?

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:29:28

    app.use(bodyParser({
      limit: 2000000  //2m
    }));

    With this setting, you can modify the limit size, transfer images, and your fields should be enough

    reply
    0
  • Cancelreply