什么是Axios默认超时

时间:2019-09-18 15:05:39

标签: 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分钟后我看到程序超时。

1 个答案:

答案 0 :(得分:1)

根据自述文件,该值为0,表示没有超时

  

// timeout指定请求超时之前的毫秒数。

     

//如果请求花费的时间超过0,则请求将被中止。     超时:1000,

     

//默认为{{1}}(无超时)

https://github.com/axios/axios/blob/master/README.md#request-config