Skip to content

Commit

Permalink
Merge pull request #13 from repl-mike-roest/allow-callback
Browse files Browse the repository at this point in the history
fix readme documentation
  • Loading branch information
luispabon authored Oct 11, 2023
2 parents 7278ccb + 682cc43 commit 1f0565e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function retry (retries, delays, allowedStatuses, retryCallback) {}
* **a list of numbers:** delays between the first few retries, in order given. If there are more retries than
numbers on this list, any subsequent retries will be delayed by the last number on the list.
* `allowedStatuses`: list of HTTP statuses that aren't considered a failure by which we need to retry
* `retryCallback`: this callback takes a single argument, the `response` object, and must performs an evaluation on it
* `retryCallback`: this callback takes two arguments, the err, and the `response` object, and must performs an evaluation on it
that must return either `true` or `false`. Returning `false` stops any further retries.

### Examples
Expand All @@ -61,7 +61,7 @@ superagent

superagent
.get('https://segment.io')
.retry(5, [1000, 3000], [], (res, err) => {
.retry(5, [1000, 3000], [], (err, res) => {
if (res.status === 400 && res.text.includes('banana')) {
return true
}
Expand Down

0 comments on commit 1f0565e

Please sign in to comment.