2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-27 14:47:43 +03:00

custom timeout prompt copy (#2275)

* style: ui

* feat: custom timeout txtx

* feat: custom timeout txtx
This commit is contained in:
IVLIU
2019-10-16 09:29:16 +08:00
committed by Felipe Martins
parent ccca5e0e21
commit 6284abfa06
2 changed files with 6 additions and 1 deletions
Vendored
+1
View File
@@ -49,6 +49,7 @@ export interface AxiosRequestConfig {
paramsSerializer?: (params: any) => string;
data?: any;
timeout?: number;
timeoutErrorMessage?: string;
withCredentials?: boolean;
adapter?: AxiosAdapter;
auth?: AxiosBasicCredentials;
+5 -1
View File
@@ -88,7 +88,11 @@ module.exports = function xhrAdapter(config) {
// Handle timeout
request.ontimeout = function handleTimeout() {
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
request));
// Clean up request