删除提取API默认超时

编程入门 行业动态 更新时间:2024-10-25 10:24:16
本文介绍了删除提取API默认超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Google Chrome或Mozilla Firefox的本机访存向服务器发送查询:

I'm sending queries to my server using native fetch from Google Chrome or Mozilla Firefox:

fetch(url, { method: 'POST', body: formData, credentials: 'include' })

我将服务器设置为在3分钟后发送响应,并意识到两种浏览器仅等待2分钟. Firefox在失败之前再次重新发送请求.

I set up a server to send a response after 3 minutes and realized that both browsers only wait 2 minutes. Firefox resend the request once more before failing.

是否可以定义大于2分钟的超时时间(例如无限)?

Is there a way to define a timeout bigger than 2 minutes (say infinite)?

推荐答案

据我阅读的有关MDN的fetch()文档,它没有任何指定超时的方法.

As far as I read fetch()'s documentation on MDN, it does not have any way to specify a timeout.

如果使用的是nodejs,则可以使用请求或 axios 模块. 或者您可以使用 XMLHttpRequest (浏览器中的纯JavaScript).

You can use request or axios module if you are using nodejs. or you can use XMLHttpRequest (plain javascript in browser).

有关详细信息,请参见 JavaScript中的HTTP请求超时

For more information HTTP request timeouts in JavaScript

更多推荐

删除提取API默认超时

本文发布于:2023-11-24 19:48:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626581.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!