在我的反应本机应用程序中,我尝试使用以下命令发出获取请求body
。但是,我收到错误消息unexpected EOF
。实际上,请求已发出,我的意思是我可以通过后端日志看到请求已发送,而在请求之后,它立即显示错误消息。
这是我的fetch
method.
var Url = "https://----------";
return fetch(Url, {
method: "POST",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({'number': '11111111-'})
})
.then((response) => response.json())
.then((responseJson) => {
console.log("SEND_SMS RESULT: ",responseJson);
})
.done();
这是我得到的错误屏幕。
我想说它在这一行失败了:response.json()
您确定您的响应是有效的 JSON 吗?
尝试使用 Postman 测试响应或添加.catch(e => console.log(e))
before done();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)