Skip to content

Extend Rate and Rate Limiting with X-Ratelimit-Used and X-Ratelimit-Resource headers - #3453

Merged
gmlewis merged 2 commits into
google:masterfrom
andygrunwald:rate-extend-used-resource
Jan 27, 2025
Merged

Extend Rate and Rate Limiting with X-Ratelimit-Used and X-Ratelimit-Resource headers#3453
gmlewis merged 2 commits into
google:masterfrom
andygrunwald:rate-extend-used-resource

Conversation

@andygrunwald

Copy link
Copy Markdown
Contributor

GitHub introduced two new headrs when it comes to rate limiting:

  • X-Ratelimit-Used
  • X-Ratelimit-Resource

See 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 Rate response.
Additionally, the key used is added into the response from the /rate_limit API endpoint.

For the Rate type, the docs have been updated according to the original GitHub API docs.

@gmlewisgmlewis added the NeedsReview PR is awaiting a review before merging. label Jan 25, 2025
@codecov

codecovBot commented Jan 25, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.03%. Comparing base (3a72a02) to head (0c5dd33).
Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

@gmlewis

Copy link
Copy Markdown
Collaborator

Thank you, @andygrunwald ! Please run ./script/generate.sh and push the changes to this PR.

@andygrunwald

Copy link
Copy Markdown
ContributorAuthor

@gmlewis Done, see 0c5dd33

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

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!

@stevehipwellstevehipwell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmlewis

Copy link
Copy Markdown
Collaborator

Thank you, @stevehipwell!
Merging.

@gmlewis
gmlewis merged commit e8d69e7 into google:masterJan 27, 2025
@andygrunwald
andygrunwald deleted the rate-extend-used-resource branch January 27, 2025 13:32
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReviewPR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@andygrunwald@gmlewis@stevehipwell