Skip to content

Commit

Permalink
fix: fix codesmells in retry-handler (#3475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Aug 16, 2024
1 parent 25d431b commit ab42afc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/handler/retry-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ab42afc

Please sign in to comment.