HTTP 请求成功处理为错误(firefox)?

问题描述 投票:0回答:1

我的应用程序上有一个 POST 休息,可以从另一个服务获取数据。返回响应需要 10 到 100 秒之间的时间。在 Firefox 上,当需要更多时间(通常大约 30 秒或更长时间)时,会返回响应,并带有状态代码 200 和正确的正文(如在 devtools 中所示),但 Angular 应用程序将其作为错误处理。其他浏览器不会出现此问题。

this._http.post(url, {}).subscribe({
            next: (response) => {
                console.log("Success");
            },
            error: (error) => {
                console.log("Error");
            },
        });

在上面的示例中,尽管开发工具中的状态为成功,但控制台中仍记录了“错误”。 (_http 是来自 @angular/common 的 HttpClient)

控制台也有错误:

A ServiceWorker intercepted the request and encountered an unexpected error. ngsw-worker.js

可能是什么原因?

angular http firefox
1个回答
0
投票

可能是由于 Firefox 浏览器上的扩展所致。尝试在 Firefox 浏览器上删除/禁用扩展(如果已安装)。

© www.soinside.com 2019 - 2024. All rights reserved.