当发送以 Base64 编码的 pdf 作为正文的发布请求时,我收到错误
错误:请求正文大于 maxBodyLength 限制
我已尝试设置以下两项
'maxContentLength':无穷大, 'maxBodyLength':无穷大
在请求配置中
const result = await axios({
url: `the url`,
headers: {'Authorization': `Bearer ${auth_token}`, 'Content-Type': 'application/json'},
method: 'post',
data: {
'ParentId': record_id,
'Name': file_name,
'body': body,
'Description': description ? description : "",
'maxContentLength': Infinity,
'maxBodyLength': Infinity
}
});
有人有解决办法吗?
最佳答案
您正在设置
'maxContentLength': Infinity,
'maxBodyLength': Infinity
在您的数据对象中。它应该位于配置对象内部,外部数据对象。
关于node.js - 错误: Request body larger than maxBodyLength limit when sending base64 post request Axios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56868023/