I'm trying to make an API call to a https://
resource using Axios inside React Native.
I'm making the call as follows:
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
instance.get('https://foodspecials-api.local/api/v1/specials/2')
.then((response) => {
console.log('WORKED');
console.log(response);
})
.catch((e) => {
console.log('FAILED');
console.log(e);
});
This, however, results in an error message ReferenceError: Can't find variable: https
I've created a SSL certificate which is self-signed.
Is there a workaround for this?