我在文档中找到了设置超时值的步骤。
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
但我在 axios 官方文档中找不到默认值 -https://github.com/axios/axios https://github.com/axios/axios
默认超时是多少?
此外,在 AXIOS 之下使用 http 服务器/客户端(https://nodejs.org/api/http.html#http_class_http_clientrequest https://nodejs.org/api/http.html#http_class_http_clientrequest)
它使用http默认超时吗?
我看到我的程序在 2 分钟后超时。
根据README,它是0,表示没有超时
// `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://github.com/axios/axios/blob/master/README.md#request-config
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)