Como posso passar parâmetros POST na solicitação de busca? - Reagir nativo
Este é o meu código:
componentWillMount() {
fetch("http://10.4.5.114/localservice/webservice/rest/server.php", {
method: 'POST',
body: JSON.stringify({
wstoken: 'any_token',
wsfunction: 'any_function',
moodlewsrestformat: 'json',
username: 'user',
password: 'pass',
})
})
.then((response) => response.text())
.then((responseText) => {
alert(responseText);
})
.catch((error) => {
console.error(error);
});
}
No navegador, essa solicitação retorna um token, mas no meu aplicativo android nativo do react retorna um erro xml.