node.js - 错误:发送base64 post请求Axios时请求正文大于maxBodyLength限制
问题描述
当以 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
在您的数据对象中。它应该在配置对象内部,数据对象外部。
推荐阅读
- mongodb - groupby 用于 mongodb 中形状的风味
- swiftui - 在 SwiftUI 中拍摄谷歌地图的快照并发送到相册
- jquery - 点击时 - 找到被点击元素的索引 - 它之前出现了多少次?
- c++ - 使用递归创建二叉树时出现堆栈溢出错误
- java - ActiveMQ Artemis 只向组中的一台服务器广播发送消息
- pine-script - & 条件不工作 - 新手问题 tradingview pinescript
- firebase - 使用 Google 和 Firebase 反应原生身份验证
- r - 如何避免 ggplot 在 R 中的因子内分组
- lua - 如何获得最近的玩家(FiveM Lua)
- postgresql - Postgres StatefulSet 已成功创建 - 但尚未准备好