Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.retry() gets invoked even upon successful request #1526

Closed
IAMtheIAM opened this issue Nov 10, 2019 · 0 comments · Fixed by #1527
Closed

.retry() gets invoked even upon successful request #1526

IAMtheIAM opened this issue Nov 10, 2019 · 0 comments · Fixed by #1527

Comments

@IAMtheIAM
Copy link
Contributor

IAMtheIAM commented Nov 10, 2019

BUG: The retry() method gets invoked on every request, even if the request is successful. See: https://github.com/visionmedia/superagent/blob/95acfc700a11ce2377d6bb524749d94e0978b846/src/client.js#L647-L650

However, it should only get invoked on an unsuccessful request. Currently we have to check for err to ensure that the request actually failed, or the logic will get executed there undesirably.

The code should be updated to:

  if (err !== null && this._shouldRetry(err, res)) {
    return this._retry();
  }

I will make a PR if this is agreed to.

niftylettuce added a commit to cabinjs/axe that referenced this issue Jul 7, 2020
niftylettuce added a commit to cabinjs/cabin that referenced this issue Jul 7, 2020
niftylettuce added a commit to forwardemail/free-email-forwarding that referenced this issue Jul 7, 2020
imgbot bot pushed a commit to pablopunk/forwardemail.net that referenced this issue Aug 26, 2020
titanism pushed a commit to forwardemail/free-email-forwarding that referenced this issue Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant