diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index e00e82faf08..b4b50b29541 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -281,7 +281,11 @@ class RetryHandler { // Weak etags are not useful for comparison nor cache // for instance not safe to assume if the response is byte-per-byte // equal - if (this.etag != null && this.etag.startsWith('W/')) { + if ( + this.etag != null && + this.etag[0] === 'W' && + this.etag[1] === '/' + ) { this.etag = null } @@ -339,6 +343,11 @@ class RetryHandler { onRetry.bind(this) ) + /** + * @this {RetryHandler} + * @param {Error} [err] + * @returns + */ function onRetry (err) { if (err != null || this.aborted || isDisturbed(this.opts.body)) { return this.handler.onError(err)