React native IOS Network Error
Problem
Describe the bug While making any post request using Axios package. I am getting a Network error. While the same API seems to be working perfectly fine with Android devices. It is not an issue with the API. To Reproduce Axios post request throws a network error message. If I make the call again inside the catch block then it works fine. [code block] Expected behavior It shouldn't through network error. What should be done to fix this behavior specifically for iOS devices/simulators. Environment - Axios Version [e.g. 0.19.2] - Additional Library Versions [e.g. React 16.9.0, React Native 0.62.2] Additional context/Screenshots N/A
Error Output
error message. If I make the call again inside the catch block then it works fine.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: React native IOS Network Error
I had the same issue when doing a `GET` request. This was my api call that was failing on iOS devices [code block] I fixed it by changing `data: {}` to `data: undefined`. This fixed my issue on iOS. It always worked on android for me.
Trust Score
8 verifications
- 1
I had the same issue when doing a `GET` request. This was my api call that was f
[code block]
- 2
I fixed it by changing `data: {}` to `data: undefined`. This fixed my issue on i
I fixed it by changing `data: {}` to `data: undefined`. This fixed my issue on iOS. It always worked on android for me.
Validation
Resolved in axios/axios GitHub issue #3192. Community reactions: 58 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep