danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
717 stars 69 forks source link

feat: retries & timeouts #219

Closed danielgtaylor closed 9 months ago

danielgtaylor commented 9 months ago

This adds support to Restish for automatic retries and timeouts. See the updated docs for examples. Here is what it looks like in practice:

$ restish api.rest.sh/status/429?x-retry-in=200ms
WARN: Got 429 Too Many Requests, retrying in 200ms
WARN: Got 429 Too Many Requests, retrying in 200ms
HTTP/2.0 429 Too Many Requests
... response headers truncated ...

This updates the core request handling functionality in Restish, so it equally applies to bulk resource management and any scripts you may have with loops or pagination making many requests over a short period of time.

Also includes some minor updates to the release scripts and the frontend syntax highlighter to make the examples pretty.

codecov[bot] commented 9 months ago

Codecov Report

Merging #219 (cda6260) into main (9c15903) will increase coverage by 0.30%. The diff coverage is 91.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
+ Coverage   76.66%   76.96%   +0.30%     
==========================================
  Files          26       26              
  Lines        3583     3643      +60     
==========================================
+ Hits         2747     2804      +57     
+ Misses        636      634       -2     
- Partials      200      205       +5     
Files Coverage Δ
cli/request.go 67.41% <100.00%> (+7.14%) :arrow_up:
cli/flag.go 53.65% <66.66%> (+10.80%) :arrow_up:
cli/cli.go 70.00% <33.33%> (-0.46%) :arrow_down:

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9c15903...cda6260. Read the comment docs.