【发布时间】:2017-10-14 00:44:32
【问题描述】:
我很难诊断这个错误,所以我希望有人能指出我正确的方向。
在 Angular 4 应用程序中,我正在对 YouTube 数据 API 进行 http.get 调用——在 Chrome 中一切正常。但是,在 Safari 中,正在发生刷新。 URL 短暂地得到一个“?”附加(例如,http://localhost:4444/youtubetest 变为 http://localhost:4444/youtubetest?)。执行在 http.get 调用处停止,页面/应用程序刷新。使用 Charles Proxy 进行监控显示响应(200)是:客户端在收到整个响应之前关闭连接
没有出现错误,页面刷新很快我可以在 Safari 中重现该问题。
在调用失败之前,我正在调用运行良好的 YouTube 搜索 API:https://www.googleapis.com/youtube/v3/search
什么会导致这种行为?真正的问题不是 http 调用,因为我可以自己运行它(curl)并且它可以工作。所有其他部分似乎都发生了一些事情,但我没有发布所有代码,而是想知道接下来要尝试什么来诊断问题。
这是执行 HTTP 调用的代码:
url: 'https://www.googleapis.com/youtube/v3/videos',
idKey: 'videoId',
method: 'GET',
...
return this.http.get(this.url, options)
.map(response => response.json())
.catch(this.handleError)
.do(res => {
// This does not run...
console.log('returned video details');
});
【问题讨论】:
标签: angular safari youtube-data-api