错误:在发送base64后请求Axios时,请求正文大于maxBodyLength限制 [英] Error: Request body larger than maxBodyLength limit when sending base64 post request Axios

查看:75
本文介绍了错误:在发送base64后请求Axios时,请求正文大于maxBodyLength限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当发送带有Base64编码的pdf作为正文的发帖请求时,我会收到错误消息

When sending a post request with a Base64 encoded pdf as the body i recieve the error

错误:请求正文大于maxBodyLength限制

Error: Request body larger than maxBodyLength limit

我尝试设置以下两项

'maxContentLength':无穷大,'maxBodyLength':无穷大

'maxContentLength': Infinity, 'maxBodyLength': Infinity

在请求配置中

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

在您的数据对象中.它应该位于配置对象内部,外部数据对象.

In your data object. It should be inside the config object, outside the data object.

这篇关于错误:在发送base64后请求Axios时,请求正文大于maxBodyLength限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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