From 8c85f723c687eb4e1acb8154fe36abc774aaf065 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Wed, 4 Nov 2020 10:49:30 +0800 Subject: [PATCH] Update index.js Do not use cloned agent --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 50a1ca5..f11a1f4 100644 --- a/index.js +++ b/index.js @@ -130,10 +130,12 @@ Request.prototype._tryUntilFail = function () { err.attempts = this.attempts; } + const originalAgent = this.options.agent; var mustRetry = await Promise.resolve(this.retryStrategy(err, response, body, _.cloneDeep(this.options))); if (_.isObject(mustRetry) && _.has(mustRetry, 'mustRetry')) { if (_.isObject(mustRetry.options)) { this.options = mustRetry.options; //if retryStrategy supposes different request options for retry + this.options.agent = originalAgent; } mustRetry = mustRetry.mustRetry; }