>  Q&A  >  본문

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일 전684

모든 응답(2)나는 대답할 것이다

  • 黄舟

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

    拆开分为多个单键值对的对象呢?

    회신하다
    0
  • 高洛峰

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

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

    这样设置可以修改限制的大小,传输图片都是可以的,你的字段也因该是够的

    회신하다
    0
  • 취소회신하다