我是新来的反应原生,并遵循 this tutorial. 我正在尝试将json主体发送到私有api服务器,我检查了服务器日志,发现正文内容为空. 这是反应原生的代码 authenticateLogIn(){ fetch('URL', { method: 'POST
我正在尝试将json主体发送到私有api服务器,我检查了服务器日志,发现正文内容为空.
这是反应原生的代码
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();也许是因为它被称为标题? (与s)