Skip to content

Commit

Permalink
Update README with new usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cpv123 committed Dec 6, 2018
1 parent edf03ab commit a067ca5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ superagent
.retry(2, 5000, [401, 404]) // retry twice before responding, wait 5 seconds between failures, do not retry when response is success, or 401 or 404
.end(onresponse);

superagent
.get('https://segment.io')
.retry(3, [1000, 3000, 10000], [401, 404]) // retry three times before responding, first wait 1 second, then 3 seconds, and finally 10 seconds between failures, do not retry when response is success, or 401 or 404
.end(onresponse);

superagent
.get('https://segment.io')
.retry(5, [1000, 3000], [401, 404]) // retry five times before responding, first wait 1 second, and then wait 3 seconds between all other failures, do not retry when response is success, or 401 or 404
.end(onresponse);

function onresponse (err, res) {
console.log(res.status, res.headers);
console.log(res.body);
Expand Down

0 comments on commit a067ca5

Please sign in to comment.