I have the following code in my component:
fetch('https://domain.com/api', {
method: 'POST',
headers: {'Accept': 'application/json', 'Content-Type': 'application/json'},
body: JSON.stringify({
key: 'value'
})
}).
then((response) => {
console.log('Done', response);
});
And every time the request is a GET (checked server logs). I thought it was something to do with CORS
(but apparently no such thing in react-native
) and ATS (but already turned off by default, plus my domain is HTTPS). I've tried from a browser and from a curl
and it worked perfectly, so a priori no issue on server configuration. Any idea what's going on here?
I'm using the latest react-native
version.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…