[英]Error: StatusCodeError: 413 - {“error”:{“code”:413,“message”:“request entity too large”}}
We have this request error where we were not able to send the request in express server even though we set parameterLimit and bodyParser. 即使设置了parameterLimit和bodyParser,我们也无法在快速服务器中发送请求时出现了此请求错误。
we have tried setting parameterLimit:50000000000000, but still the same issue 我们已经尝试设置parameterLimit:50000000000000,但仍然是同样的问题
app.use(bodyParser.json({limit: '15360mb', type: 'application/json'}))
app.use(bodyParser.urlencoded({limit: '15360mb', extended: true, type: 'application/json', parameterLimit: 5000000}))
We use 我们用
Node:8.9.4
body-parser: '1.18.3'
express: '4.17.0'
From docs: 从文档:
request entity too large 请求的实体太大
This error will occur when the request body's size is larger than the
"limit"
option. 当请求正文的大小大于"limit"
选项时,将发生此错误。 The limit property will be set to the byte limit and the length property will be set to the request body's length. limit属性将设置为字节限制,而length属性将设置为请求正文的长度。 The status property is set to 413 and the type property is set to 'entity.too.large'. status属性设置为413,type属性设置为'entity.too.large'。limit 限制
Controls the maximum request body size. 控制最大请求正文大小。 If this is a number, then the value specifies the number of bytes; 如果这是一个数字,则该值指定字节数; if it is a string, the value is passed to the bytes library for parsing. 如果是字符串,则将值传递到字节库进行解析。 Defaults to '100kb' 默认为'100kb'
So you've to increase the limit
option. 因此,您必须增加limit
选项。 For example, for json
, setting limit
to 10 MB
例如,对于json
,将limit
设置为10 MB
bodyParser.json({ limit: '10mb' })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.