-
Notifications
You must be signed in to change notification settings - Fork 79
Add helpers to access the scope and rate limit headers. #103
Conversation
return strings.Split(r.RawAcceptedScopes(), ",") | ||
} | ||
|
||
func (r *Result) ValidScope(scope string) bool { |
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.
Should this logic be built into the application instead of octokit?
In general, LGTM. Could add some tests though. @pengwynn What do you think? |
func (r *Result) RateLimitRemaining() int { | ||
rate, err := strconv.Atoi(r.Response.Header.Get(rateLimitRemaining)) | ||
if err != nil { | ||
rate = 60 |
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.
This is tricky, because Enterprise, right?
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.
I don't remember anymore how that thing works 😆 I guess I can check the response host and set the default to 60 in the case of api.github.com
Thanks for the patch @calavera. 💖 I left a couple of notes. |
Thank you guys, I'll add some tests today. |
…valid. Add test for result helpers. Signed-off-by: David Calavera <david.calavera@gmail.com>
It's currently not rate limited. I think |
Add helpers to access the scope and rate limit headers.
👍 |
No description provided.