Skip to content

Commit ab42afc

Browse files
authored
fix: fix codesmells in retry-handler (#3475)
1 parent 25d431b commit ab42afc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/handler/retry-handler.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ class RetryHandler {
281281
// Weak etags are not useful for comparison nor cache
282282
// for instance not safe to assume if the response is byte-per-byte
283283
// equal
284-
if (this.etag != null && this.etag.startsWith('W/')) {
284+
if (
285+
this.etag != null &&
286+
this.etag[0] === 'W' &&
287+
this.etag[1] === '/'
288+
) {
285289
this.etag = null
286290
}
287291

@@ -339,6 +343,11 @@ class RetryHandler {
339343
onRetry.bind(this)
340344
)
341345

346+
/**
347+
* @this {RetryHandler}
348+
* @param {Error} [err]
349+
* @returns
350+
*/
342351
function onRetry (err) {
343352
if (err != null || this.aborted || isDisturbed(this.opts.body)) {
344353
return this.handler.onError(err)

0 commit comments

Comments
 (0)