Fetch request giving HTML response only on Android in React Native app

135 views Asked by At

I have a react native app and a normal fetch request for login is not behaving ideally for Android. I'm making a normal fetch request like this for Login--

fetch('https://mywebsite.com/endpoint/', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    firstParam: 'yourValue',
    secondParam: 'yourOtherValue',
  }),
});

Now, this works totally fine on iOS and I get the JSON response which I'm supposed to. But on Android, I get an HTML response. And that HTML response is the web counterpart of the app. What could be the possible issues for this? since I'm told that issue is at my end and couldn't find anything. Also, I've checked it on Postman and it is working fine.

0

There are 0 answers