Skip to content

status is missing in AxiosError on and after v1.13.3 #7364

@hermanho

Description

@hermanho

Here is a test case in test/unit/regression/bugs.js:

describe('9999', function () {
  it('should have status code in axios error', async function () {
    const instance = axios.create({
      baseURL: "https://postman-echo.com",
      adapter: "fetch",
    });
    try {
      await instance.get("/status/400");
    } catch (error) {
      assert.equal(error.name, "AxiosError");
      assert.equal(error.isAxiosError, true);
      assert.equal(error.status, 400);
    }
  });
});

It is passed in commit 08b84b5 v1.13.2 tag. However, it is failed in ab06109 v1.13.3 and 9336cf9 v1.13.4 tag.

$ npx mocha test/unit/regression/bugs.js


  issues
    4999
      ✔ should not fail with query parsing (235ms)
    5028
      ✔ should handle set-cookie headers as an array
    9999
      1) should have status code in axios error


  2 passing (750ms)
  1 failing

  1) issues
       999
         should have status code in axios error:
     AssertionError [ERR_ASSERTION]: undefined == 400
      at Context.<anonymous> (file:///Users/herman/Documents/github/axios/test/unit/regression/bugs.js:55:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

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