androidreact-nativereduxaxiosreact-native-debugger

React-native fetch Api get response differs from debugging mode and normal mode


I tried to call an https request get method API using the Axios method, from server it responded 200 but on the server-side, the API is not hit. Don't know where the response is coming from, the same API I have tried using post-man, I got 200 status with updated response correctly. after that I started using react-native-debugger to debug the responses, I debugged with the network inspector and I have tried the same API, it got a correct response with 200. what will be the issue in this. Someone, please help me to find out this bug.

I have added the code below using fetch, the same is happening in Axios calls too. Also found one thing while enabling network inspector in react-native-debugger the API works perfectly.

fetch(requestUrl, {
       method: methods.get,
       headers: head,
     })
       .then(response => response.json())
       .then(responseJson => {
         console.log('res JSON', responseJson);
           alert('your todolist is completed!!');
        }
       })
       .catch(error => {
         console.error(error);
       });

Solution

  • React Native - Fetch call cached

    Found the answer for this question in the above link, it stores a cache in Axios or fetch itself. Not it works perfectly. Thank you all.