axios - 什么是axios默认超时
问题描述
我在文档步骤中找到了设置超时值。
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
但是我在 axios 官方文档中找不到默认值 - https://github.com/axios/axios
默认超时是多少?
此外,AXIOS 下方使用 http 服务器/客户端(https://nodejs.org/api/http.html#http_class_http_clientrequest)
它是否使用http默认超时?我看到我的程序在 2 分钟后超时。
解决方案
根据自述文件,它是 0 表示没有超时
//
timeout
指定请求超时前的毫秒数。// 如果请求时间超过
timeout
,请求将被中止。超时:1000,// 默认是
0
(没有超时)
https://github.com/axios/axios/blob/master/README.md#request-config
推荐阅读
- rust - Bevy 0.5:在列中排列文本
- python - 如何解决此背景颜色问题?
- python - Python如何自动更改每个脚本执行的文件路径?
- android - Kotlin 测试 Firebase
- google-data-studio - 如何在 getFields()(Google Data Studio Community Connector)中定义的计算字段中使用参数?
- python - 是否可以将多个管道组合到 Neuraxle 或 sklearn 中的单个估计器中以创建多输出分类器并一次性适应
- database - 如何更新数据库列中的多个数据?
- java - 如何使用 MongoDB GridFS 为 Java 中的多个集合有效地保存和查询图像
- scala - 如何在 Scala 中为未来添加截止日期?
- jquery - 在不重新加载页面的情况下从数据库加载数据的最佳方法是什么?