【发布时间】:2019-02-02 01:11:01
【问题描述】:
我正在使用 js fetch API 从 JSON 中检索数据。 它工作正常(即使在 IE 11 中),除了在 Edge 17 中我得到 302,响应头是:
- 内容长度:0
- 内容类型:文本/纯文本; charset=utf-8
- 位置:http://local.mysite.com/xxx
我的本地网站在 Mac 上,我正在使用 BrowserSync 使其可通过 192.168.100.X:3000 访问 然后我像这样更新了我的 PC 主机文件:
192.168.100.X http://local.mysite.com
这是我的 fetch 调用:
fetch('/fr/fil-actualites-json', { mode: 'cors' })
.then(
function(response) {
console.log('code :' +response.status);
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
// do some stuff
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
感谢您的帮助;)
【问题讨论】:
标签: json microsoft-edge fetch-api http-status-code-302