I'm using fetch command, running on Android emulator. When I used it with port "127.0.0.1" I got this error all the time no matter what type of request I was doing.
Then I changed it to http://10.0.2.2, and GET requests generally work, but I'm trying to make a POST request and get this error:
TypeError: Network request failed
My code:
const url = 'http://10.0.2.2:143' const payload = { method, headers: { Accept: 'application/json','Content-Type': 'application/json', ['x-access-token']: `Bearer ${token}`, }, body, } const response = await fetch(url, payload)
On iOS everything's working fine so I don't think it's a problem with this code. What can I try to make it work on Android
The request doesn't even reach the server