From 8966ee7ea62ecbd6cfb39a905939bcdab5cf6388 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Tue, 30 Jul 2024 20:38:22 +0200 Subject: [PATCH] fix(xhr): return original config on errors from XHR adapter (#6515) --- lib/adapters/xhr.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index e9b8e80..c4bf677 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -95,7 +95,7 @@ export default isXHRAdapterSupported && function (config) { return; } - reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); // Clean up request request = null; @@ -105,7 +105,7 @@ export default isXHRAdapterSupported && function (config) { request.onerror = function handleError() { // Real errors are hidden from us by the browser // onerror should only fire if it's a network error - reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request)); // Clean up request request = null; @@ -121,7 +121,7 @@ export default isXHRAdapterSupported && function (config) { reject(new AxiosError( timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, - _config, + config, request)); // Clean up request