-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Extend Rate and Rate Limiting with X-Ratelimit-Used and X-Ratelimit-Resource headers
#3453
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
Extend Rate and Rate Limiting with X-Ratelimit-Used and X-Ratelimit-Resource headers
#3453
Conversation
…mit-Resource` headers GitHub API docs: - Rate Limiting Header: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#checking-the-status-of-your-rate-limit - Rate Limiting Resource: https://docs.github.com/en/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3453 +/- ##
=======================================
Coverage 91.02% 91.03%
=======================================
Files 179 179
Lines 15529 15535 +6
=======================================
+ Hits 14136 14142 +6
Misses 1221 1221
Partials 172 172 ☔ View full report in Codecov by Sentry. |
|
Thank you, @andygrunwald ! Please run |
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @andygrunwald!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
@stevehipwell - might you have time for a code review? Thank you!
stevehipwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thank you, @stevehipwell! |
GitHub introduced two new headrs when it comes to rate limiting:
X-Ratelimit-UsedX-Ratelimit-ResourceSee https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#checking-the-status-of-your-rate-limit
For which resources are available, see https://docs.github.com/en/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user
This Pull Request extends the Rate Limiting Header parsing and adds the two new information into the
Rateresponse.Additionally, the key
usedis added into the response from the/rate_limitAPI endpoint.For the
Ratetype, the docs have been updated according to the original GitHub API docs.