Sails.js bodyParser-版本0.10.5上的请求实体太大 [英] Sails.js bodyParser - request entity too large on version 0.10.5

查看:118
本文介绍了Sails.js bodyParser-版本0.10.5上的请求实体太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将很多数据发布到我的Sails API中,但出现此413错误:

I am trying to post a lot of data to my sails API and I get this 413 error:

Unable to parse HTTP body- error occurred - Error: request entity too large

我尝试了很多在不同讨论中建议的解决方案,但是它永远都行不通,而且似乎适用于以前的Sails版本. (总是与更改bodyParser选项有关)

I have tried a lot of solutions suggested in differents discussions but it never works and seems to be for previous sails version. (it’s always about changing the bodyParser options)

有人知道帆0.10.5的正确语法吗? 非常感谢!

Does anybody know the correct syntax for sails 0.10.5? Thanks a lot!

推荐答案

有人知道帆0.10.5的正确语法吗?非常感谢!

Does anybody know the correct syntax for sails 0.10.5? Thanks a lot!

看看这个解决方案(v.0.11.0,config/http.js):

Take a look at this resolution (sails v.0.11.0, config/http.js):

module.exports.http = {

  middleware: { ... },

  bodyParser: function(){
    var opts = {
      limit:'10mb'
    }
   return require('./../node_modules/sails/node_modules/skipper')(opts);
  }
}

这篇关于Sails.js bodyParser-版本0.10.5上的请求实体太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆