+
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ func (ae *AcceptedError) Is(target error) bool {
}

// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
// "documentation_url" field value equal to "https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits".
// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits".
type AbuseRateLimitError struct {
Response *http.Response // HTTP response that caused this error
Message string `json:"message"` // error message
Expand Down Expand Up @@ -1259,7 +1259,7 @@ func CheckResponse(r *http.Response) error {
}
case r.StatusCode == http.StatusForbidden &&
(strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits") ||
strings.HasSuffix(errorResponse.DocumentationURL, "#secondary-rate-limits")):
Copy link
Contributor Author

@Letiste Letiste Nov 23, 2023

Choose a reason for hiding this comment

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

Would it be good to also check for secondary rate limit in the error message to be more resilient to future documentation updates?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, either or should be fine.

strings.HasSuffix(errorResponse.DocumentationURL, "secondary-rate-limits")):
abuseRateLimitError := &AbuseRateLimitError{
Response: errorResponse.Response,
Message: errorResponse.Message,
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载