I am new to contributing to the native response and following this tutorial .
I am trying to send a json body to a private api server, I checked the server log and found out that the contents of the body are empty.
Here is the code in real native
authenticateLogIn(){
fetch('<URL>', {
method: 'POST',
header: {'Content-Type': 'application/json', 'Accept': 'application/json'},
body: JSON.stringify({'username': '<username>', 'password':'<password>'})
})
.then((incoming) => incoming.json())
.then((response) => {
console.log(response.header);
Alert.alert(JSON.stringify(response.body));
})
.done();
source
share