Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxContentLength size of -1 exceeded when response status is 204 #5286

Open
amirAlamian opened this issue Nov 19, 2022 · 4 comments
Open

maxContentLength size of -1 exceeded when response status is 204 #5286

amirAlamian opened this issue Nov 19, 2022 · 4 comments

Comments

@amirAlamian
Copy link

amirAlamian commented Nov 19, 2022

Describe the bug

Hi. I'm using axios in my backend server and when I send a request to a server which is responding with 204 status code, Axios throws an error with this message : maxContentLength size of -1 exceeded.
I tried to increase the value of maxContentLength variable in the axios config. I event set the MAX_SAFE_INTEGER value for this variable but its not working.
any help

To Reproduce

No response

Code snippet

No response

Expected behavior

No response

Axios Version

1.1.3

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

18.12.0

OS

Linux (ubuntu 22.04)

Additional Library Versions

No response

Additional context/Screenshots

No response

@mariuszste
Copy link

It seems like this error is also thrown when the response stream is aborted mid way through the transfer.
A bit weird if you ask me. Maybe we should have a separate error for that?

image
image

@05Tushar
Copy link

@amirAlamian did you find a solution for this? I am facing the same issue.

@tachibanayu24
Copy link

The same problem seems to occur in v1.5.1.

@hasys
Copy link

hasys commented May 22, 2024

It is still there. The solution is to clear data from the response on the server side. And set the Content-Length header to 0 if the response is 204 No Content. Otherwise AXIOS will fail with this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants