* feat(fetch): add fetch, Request, Response env config variables for the adapter;
* feat(fetch): fixed design issue for environments without fetch API globals;
* test: test to support reviver on JSON.parse
* feat: support reviver for JSON.parse on parse response data
#5924
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix(types): change the type guard on isCancel
… to `CanceledError<any>`. This makes more sense as it reflects what
`isCancel` is actually doing. In fact, if I'm not mistaken, the
`Cancel` type is no longer in the project. It got removed in
7f12366. It should probably also be removed from the types.
* Parameterize `CanceledError` in `isCancel`
Thanks to @samavati for the suggestion.
Co-authored-by: Ehsan Samavati <samaavaati@gmail.com>
---------
Co-authored-by: Ehsan Samavati <samaavaati@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
* 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
* feat(types): added js native interface for fetchOptions
* fix(types): adjusted to fetchOptions accept any value as the original version
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
* updated interceptor use type definition to remove interceptor options parameter from use method for response interceptors
* incorporated type changes to index.d.cts
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
This is done by duplicating `index.d.ts` into `index.d.cts`, and
modifying it for CommonJS. The same was done for type tests.
Unfortunately I was unable to find a way to re-use types without
drastically changing the code base.
To test this, a minimum TypeScript version of 4.7 is needed, so it has
been updated. The old types still work with older TypeScript versions.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Refactored AxiosHeaders class;
* Added support for instances of AxiosHeaders as a value for the headers option;
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fixed type definition use method on AxiosInterceptorManager to match the README
* fixed parentheses issues with type
Co-authored-by: Jay <jasonsaayman@gmail.com>
* feat: add boolean flag to mimic pre 1.x behavior for paramsSerializer custom function
* chore: update ParamsSerializer Readme
* fix: dont slice hash off URL if not appending params
* Omit nulls from formData serialization
* fix: dont add nulls or undefined values to arrays either
* readme update
* fix test
* chore: documentation
* chore: do TS properly
Co-authored-by: Jay <jasonsaayman@gmail.com>