-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
AxiosError ERR_NETWORK contains request as response #4655
Copy link
Copy link
Closed
Description
Describe the bug
When performing an axios request which is rejected with ERR_NETWORK the created AxiosError contains the request as response.
This leads to the issue that the response of the AxiosError contains the status code 200 and the body of the request although in reality no response was received.
I think the issue is that the request is passed as 5th parameter (response) of the AxiosError constructor here:
Line 119 in bc733fe
| reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request)); |
To Reproduce
Sample project:
sample.zip
Running the sample project with npm run test prints the following to the console:
error code: ERR_NETWORK
response status: 200
response body: {"foo":"bar"}
Expected behavior
The response field in the AxiosError created due to ERR_NETWORK should be undefined.
Environment
- Axios Version 0.27.2
- Adapter XHR
- Browser -
- Browser Version -
- Node.js Version 18.0.0
- OS: macOS 12.3.1
- Additional Library Versions msw: ^0.39.2
Additional context/Screenshots
NA
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels