axios request with headers only working if react-native-debugger is enabled

Viewed 509

I have this weird experience like if I enable network inspect in react native debugger then the Axios request sends response properly, but if I disable the network inspect then the response I get is wrong.

In detail: I have an API that returns the token expired status I have set the token to expire to 1 day so if the token expires I get '-1' if the token is valid I get '0'. But if I enable network inspect then the responses are correct, if I disable network inspect then it does not check the token for expiring like the API returns '0' for both correct and wrong token. This works fine in postman also.

see my API request below:

await axios({
        method: 'POST',
        url: `https://xxxxxxxxx.in/univadmin/app.phpa=uniliteGetMenus&univcode=${data.funivcode}`,
        data: {
            mobile: data.fmobileno,
            imei: 'imei'
        },
        headers: {
            'X-Auth-Origin': 'UXXXXXE',
            'X-Auth-Token': token,
            'Content-Type': 'application/json'
        }
    })
1 Answers

I was facing so many problem while using Axios in sending files. i recommend using RNFetchblob

Related