What is Axios default timeout

隐身守侯 提交于 2020-06-16 04:54:10

问题


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'}
});

But I could not find the default value in the official axios documentation - https://github.com/axios/axios

What is the default timeout?

Also, Underneath AXIOS uses http server/client (https://nodejs.org/api/http.html#http_class_http_clientrequest)

Does it use the http default timeout? I see my program timesout after 2 minutes.


回答1:


According to the README, it is 0 which means no timeout

// timeout specifies the number of milliseconds before the request times out.

// If the request takes longer than timeout, the request will be aborted. timeout: 1000,

// default is 0 (no timeout)

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



来源:https://stackoverflow.com/questions/57995863/what-is-axios-default-timeout

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!