Skip to content

Axios Unable to Handle "204 No Content" Responses #6327

Open
@yuchen001

Description

Describe the bug

As of today, Axios seems to be unable to handle requests that result in a "204 No Content" response. Any API request that responds with a 204 status code is treated as a timeout.

Preliminary testing and investigation suggest that the issue might be related to Axios instances.

It might be challenging to provide a publicly accessible test case since finding APIs that reliably respond with a 204 status code could be difficult.

To Reproduce

As of the latest observation, Axios encounters an issue where responses with an empty body (e.g., "204 No Content") are incorrectly treated as timeouts when using an Axios instance.

Notably, when requests are made without creating an Axios instance directly, the behavior is as expected.

Steps to Reproduce:

  • Create an Axios instance.
  • Make a request using the Axios instance to an API endpoint that returns a response with an empty body (e.g., 204 status code).
  • Observe that the Axios instance incorrectly handles the response as a timeout.

Code snippet

No response

Expected behavior

Axios should accurately handle responses with an empty body, such as 204 status codes, without treating them as timeouts.

Axios Version

No response

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions