When sending a post request with a Base64 encoded pdf as the body i recieve the error
Error: Request body larger than maxBodyLength limit
I have tried setting both of the following
'maxContentLength': Infinity, 'maxBodyLength': Infinity
in the request config
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
}
});
Does anyone have a workaround?
You are setting
'maxContentLength': Infinity,
'maxBodyLength': Infinity
In your data object. It should be inside the config object, outside the data object.
That is what worked for me:
axios({
method: 'post',
url: posturl,
data: formData,
maxContentLength: Infinity,
maxBodyLength: Infinity,
headers: {'Content-Type': 'multipart/form-data;boundary=' + formData.getBoundary()}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With