@varlet/axle 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +4 -7
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -204,15 +204,12 @@ function responseRetryInterceptor(options) {
|
|
|
204
204
|
async onRejected(error) {
|
|
205
205
|
var _a, _b;
|
|
206
206
|
const matcher = createMatcher(options.include, options.exclude);
|
|
207
|
-
if (!matcher((_a = error.config.method) != null ? _a : "", (_b = error.config.url) != null ? _b : "")) {
|
|
207
|
+
if (!matcher((_a = error.config.method) != null ? _a : "", (_b = error.config.url) != null ? _b : "") || isCancel(error)) {
|
|
208
208
|
return Promise.reject(error);
|
|
209
209
|
}
|
|
210
210
|
const { count = 1 } = options;
|
|
211
211
|
let retryCount = 0;
|
|
212
|
-
|
|
213
|
-
return Promise.reject(error);
|
|
214
|
-
}
|
|
215
|
-
async function loop() {
|
|
212
|
+
async function retry() {
|
|
216
213
|
try {
|
|
217
214
|
retryCount++;
|
|
218
215
|
return await axios2.create()(error.config);
|
|
@@ -220,10 +217,10 @@ function responseRetryInterceptor(options) {
|
|
|
220
217
|
if (retryCount === count) {
|
|
221
218
|
return Promise.reject(error2);
|
|
222
219
|
}
|
|
223
|
-
return
|
|
220
|
+
return retry();
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
|
-
return
|
|
223
|
+
return retry();
|
|
227
224
|
},
|
|
228
225
|
options: options.axiosInterceptorOptions
|
|
229
226
|
};
|