From a067ca59bd4659155fa3afa3ab273b0f7b723f8c Mon Sep 17 00:00:00 2001 From: cpv123 Date: Thu, 6 Dec 2018 22:27:59 +0000 Subject: [PATCH] Update README with new usage examples --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 691486e..1feafca 100644 --- a/README.md +++ b/README.md @@ -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);