When creating an AxiosError from an existing error without a response object,
the status property from the source error is now preserved. This ensures error
status information is not lost during error conversion.
Fixes#7364
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix: make AxiosError.message property enumerable
Restores backward compatibility by making the message property
enumerable. In v1.13.3, the refactoring to extend native Error
made message non-enumerable, breaking code that uses Object.keys(),
Object.entries(), or spread operator on AxiosError instances.
This fix uses Object.defineProperty to explicitly make the message
property enumerable while maintaining the benefits of extending
the native Error class.
Breaking change introduced in: v1.13.3 (commit 1c6a86d)
Affects: Object.keys(), Object.entries(), spread operator, for...in loops
* chore: build fix
---------
Co-authored-by: Alexander Gehres <alexander.gehres@sap.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
* feat: implement prettier and fix all issues
* fix: failing tests
* fix: implement feedback from codel, ai etc
* chore: dont throw in trim function
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix: incorrect fix
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix(interceptor): handle the error in the same interceptor
* fix(interceptor): pass the config and data in promise chain
* fix(interceptor): filter out unexpected config and data in promise chain
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix: turn AxiosError into a native error (#5394)
Being an object returned by the 'Error' constructor turns something into a 'native error'.
* fix: simplify code in AxiosError
* fix: simplify code in AxiosError
* refactor: implement AxiosError as a class
* refactor: implement CanceledError as a class
This turns CanceledError into a native error.
* refactor: simplify AxiosError.toJSON
* fix: improve error code handling in `AxiosError.from`
If no error code is provided, use the code from the underlying error.
* fix: set error status in `AxiosError.constructor`
If a response is passed to the constructor, set the response status as a property.
* fix: remove unnecessary async
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
* feat(fetch): add fetch, Request, Response env config variables for the adapter;
* feat(fetch): fixed design issue for environments without fetch API globals;
* feat(adapter): surface low‑level network error details; attach original error via `cause`
Node http adapter:
- Promote low-level `err.code` to `AxiosError.code`, prefixing message (e.g. `ECONNREFUSED – …`)
- Keep original error on standard `Error.cause`
XHR adapter:
- Preserve browser `ProgressEvent` on `error.event`
- Use event message when available
Tests:
- Add Node ESM tests under `test/unit/adapters` to assert `code` and `cause` behavior
Types:
- Ensure `AxiosError.cause?: unknown` and `event?: ProgressEvent` are present
* fix(adapter): use fs instead of fs/promises for sync file read in tests to fix GitHub Actions
* fix: prevent request url override
prevent request URL from overriding preconfigured base URL
BREAKING CHANGE: code relying on the above will now combine the URLs instead of prefer request URL
* feat: add config option for allowing absolute URLs
* fix: add default value for allowAbsoluteUrls in buildFullPath
* fix: typo in flow control when setting allowAbsoluteUrls
* feat: update tests supporting issue #5902 functionality
* feat: update README.md with allowAbsoluteUrls
* fix: properly group conditions in buildFullPath.js to avoid undefined error when baseUrl undefined
* Update README.md fix typo
* fix: update build full path logic to address failing test case
* fix: update base URL test
* fix: remove problem test (works locally, will not work in the pipeline)
* fix: update https test to use github.com instead of google.com
* fix: revert previous commit
* fix: add back problem test
* chore: remove un-needed passed var to URL class instanciation
---------
Co-authored-by: Austin Ryan Lawson <ryan.lawson2@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>