React native 从Web服务获取图像时出错
我打电话给网络服务来拍照。图像正在以过时的方式出现。当图像的总大小低于50kb时,没有问题,但当图像的总大小高于50kb时,webservice会给出如下错误:React native 从Web服务获取图像时出错,react-native,React Native,我打电话给网络服务来拍照。图像正在以过时的方式出现。当图像的总大小低于50kb时,没有问题,但当图像的总大小高于50kb时,webservice会给出如下错误: {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""} fetch('url', { method: 'POST', headers: new Headers({
{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
fetch('url', {
method: 'POST',
headers: new Headers({
'Accept': 'application/json',
'Content-Type': 'application/json', // <-- Specifying the Content-Type
}),
})
.then((response) => response.text())
.then(leaders => {
console.log('leader: ', leaders);
});
我这样称呼webservice:
{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
fetch('url', {
method: 'POST',
headers: new Headers({
'Accept': 'application/json',
'Content-Type': 'application/json', // <-- Specifying the Content-Type
}),
})
.then((response) => response.text())
.then(leaders => {
console.log('leader: ', leaders);
});
fetch('url'{
方法:“POST”,
标题:新标题({
“接受”:“应用程序/json”,
'Content Type':'application/json',//response.text()
.然后(领导者=>{
console.log('leader:',leaders);
});
错误是:
我不知道它是否正好是50,因为我的图像大小在9-10kb之间。当我调用5个图像时,它不会给出一个错误,但如果超过5个,它会给出一个如上所述的错误
这是“网络”选项卡:
关于这个问题,任何人都帮不上忙。请转到网络选项卡,查看返回的内容。显然,它不是json,因为它以字母“a”开头。这是什么意思?@Diogenesgt这显然是后端的问题,而不是移动应用程序的问题。顺便说一句,我用“react native fe”解决了这个问题tch polyfill”。此错误是由于超时。