当我调用 API 并返回错误 407 时,我想处理这种情况,但当我发现 Chrome 和 Firefox 的响应不一样时,我感到非常惊讶。
fetch('https://xxxx.xxx/xxx', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
},
}).then(function(response) {
console.log('res', response)
}, function(error) {
console.log('err', error)
})
Chrome 进入错误案例,没有什么可以告诉我这个 407 错误,但 Firefox 可以获取状态码。
我不知道这是错误还是我的错,我已经谷歌了,但我没有什么要说清楚的。请帮我解决这个问题,谢谢。