Fetch in react native not send the post
<p>Hello I am trying to send post variables to my API and I not getting the post data in the PHP file</p>

<p>This is my react native code:</p>

<pre><code>let data = {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({
        'firstname': 'test',
    }),
}
fetch(GLOBALS.API + '/registerApi.php?key=' + GLOBALS.KEY, data)
.then((response) =&gt; response.json())
.then((responseJson) =&gt; {
    Alert.alert(
      'Alert Title',
      responseJson.output
    )

})
.catch((error) =&gt; {
    console.error(error);
});
</code></pre>

<p>It's returning me empty: <code>[]</code></p>

<pre><code>$array = array(
    "output" =&gt; json_encode($_POST)
);
$output = json_encode($array);
die($output);
</code></pre>

<p>When I use <code>$_REQUEST</code> it's returning me only the <code>key</code> get parameter without the <code>firstname</code> one.</p>