* fix(progress): clamp loaded value to total in progress reducer
* test(progress): cover out-of-order events in reducer clamp case
* fix(progress): keep bytesNotified monotonic for out-of-order events
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix(fetch): remove Content-Type without boundary for FormData
When using the fetch adapter with FormData and manually setting
Content-Type to 'multipart/form-data' (without boundary), the
request would fail because the boundary is required.
This fix detects when Content-Type is set to multipart/form-data
without a boundary and removes it, allowing fetch to automatically
set the correct Content-Type header with the proper boundary.
Fixes#7054
* chore: update fixes
---------
Co-authored-by: Jason Saayman <jasonsaayman@gmail.com>
The module-level capability probe in the fetch adapter creates a
ReadableStream as a Request body to test for streaming support, but
never cancels it. The Request constructor sets up an internal pull
pipeline on the stream; since the stream is never consumed or
cancelled, the [[pullAlgorithm]] Promise remains pending indefinitely,
causing an async resource leak detectable by Node.js async_hooks and
Vitest --detect-async-leaks.
Extract the ReadableStream to a variable and call body.cancel() after
the probe completes to properly tear down the stream's internal
pipeline.
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>
* test: add error handling tests for fetch and http adapters with status code
* fix: improve error handling in fetch adapter by including request and response in AxiosError
* fix: skip fetch test if fetch is not supported
* Update lib/adapters/fetch.js
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix: improve error handling in fetch adapter by using the correct request object
---------
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>
* test(http): fix HTTPS protocol test by using local HTTPS server instead of external request
* docs: update var usage in documentation examples
* docs: updated var to const
---------
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>