问题描述
我发现在文档设置步骤中设置了超时值.
I found in the documentation steps to set the timeout value.
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
但是我无法在axios官方文档中找到默认值- https://github.com/axios/axios
But I could not find the default value in the official axios documentation - https://github.com/axios/axios
默认超时是多少?
此外,在AXIOS之下使用http服务器/客户端( https://nodejs.org/api/http.html#http_class_http_clientrequest )
Also, Underneath AXIOS uses http server/client (https://nodejs.org/api/http.html#http_class_http_clientrequest)
它使用http默认超时吗?2分钟后我看到程序超时.
Does it use the http default timeout?I see my program timesout after 2 minutes.
推荐答案
根据自述文件,该值为0表示没有超时
According to the README, it is 0 which means no timeout
//如果请求花费的时间长于timeout
,则该请求将被中止. 超时:1000,
// If the request takes longer than timeout
, the request will be aborted. timeout: 1000,
//默认为0
(无超时)
https://github.com/axios/axios/blob/master/README.md#request-config
这篇关于什么是Axios默认超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!