如何在Angular 7中将HTTP请求超时增加2分钟以上? [英] How to increase HTTP request timeout more than 2 minutes in Angular 7?

查看:138
本文介绍了如何在Angular 7中将HTTP请求超时增加2分钟以上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个超过2分钟的请求,需要在后端准备数据并进行传输.可观察到的HTTP请求的默认角度超时为2分钟.是否知道如何增加默认超时时间?

I have a request that takes more than 2 minutes to prepare the data in the backend and transmit it. The angular default time out for the HTTP request observable is 2 minutes. Any idea of how to increase the default timeout?

我在以下链接中阅读并尝试了建议的解决方案,但是如果您想将超时时间设置为2分钟以内,那么所有这些方法都可以正常工作,而且它们都无法增加超时时间!

I read and tried the proposed solution in the following links, but all of them are working if you want to set the timeout less than 2 minutes, and none of them will work for increasing the timeout!!

https://rxjs-dev.firebaseapp.com/api/operators/timeout

不能http.get?超过2分钟超时?

如何在角度5中增加HttpClient请求的等待时间?

如何在angularjs 4中设置http呼叫超时?/a>

How to set http call timeout in angularjs 4?

默认和特定请求超时

推荐答案

我在评论中没有收到您的答复,但是我的开发机上遇到了这个确切的问题,也许您也正在发生

I didn't get a reply from you in the comments, but I was having this exact issue on my dev machine, and maybe that's happening to you as well.

我正在使用代理配置以及代理服务器的默认超时为120秒(2分钟).因此,如果是这种情况,只需在配置中定义一个更高的值即可.

I was using the proxy config, and the proxy's default timeout is 120 seconds (2 minutes). So, if that's your case, simply define a higher value in the configuration.

{
  "/api": {
    "target": "http://localhost:3000",
    "secure": false,
    "timeout": 360000
  }
}

这篇关于如何在Angular 7中将HTTP请求超时增加2分钟以上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆