错误日志:
blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:55463 Possible Unhandled Promise Rejection (id: 0):
SyntaxError: Unexpected token in JSON at position 0
SyntaxError: Unexpected token in JSON at position 0
at parse (<anonymous>)
at tryCallOne (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:21859:14)
at blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:21960:17
at blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8761:21
at _callTimer (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8650:9)
at _callImmediatesPass (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8686:9)
at Object.callImmediates (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8905:14)
at MessageQueue.__callImmediates (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8239:18)
at blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8066:18
at MessageQueue.__guardSafe (blob:http://localhost:8081/d0cb8da3-cbda-4352-940d-9ad7827bfee6:8223:11)问题只出现在Android上,原生的react。我使用fetch,方法post。
示例代码:
fetch(config.server + "/api/districts", {
method: "POST"
})
.then(res => res.json())
.then(res => {
this.setState({ districts: res.data });
});发布于 2018-07-19 13:16:06
只是后端编码有问题(没有BOM的UTF-8)。
https://stackoverflow.com/questions/51394147
复制相似问题