Respond to native sampling without sending body content

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();
+4
source share
2 answers

Maybe because he shoueld heading s ? (with s)

+7
source

- , JSON . bodyParser https://github.com/expressjs/body-parser , .

req.body , app.use(bodyParser.json() server.js. , body-parser.

0

Source: https://habr.com/ru/post/1651176/


All Articles