mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-04 12:37:59 +00:00
Reset vendoring to 0.6.3
This commit is contained in:
21
vendor/github.com/google/go-github/github/github.go
generated
vendored
21
vendor/github.com/google/go-github/github/github.go
generated
vendored
@@ -501,18 +501,6 @@ func (r *RateLimitError) Error() string {
|
||||
r.Response.StatusCode, r.Message, r.Rate.Reset.Time.Sub(time.Now()))
|
||||
}
|
||||
|
||||
// AcceptedError occurs when GitHub returns 202 Accepted response with an
|
||||
// empty body, which means a job was scheduled on the GitHub side to process
|
||||
// the information needed and cache it.
|
||||
// Technically, 202 Accepted is not a real error, it's just used to
|
||||
// indicate that results are not ready yet, but should be available soon.
|
||||
// The request can be repeated after some time.
|
||||
type AcceptedError struct{}
|
||||
|
||||
func (*AcceptedError) Error() string {
|
||||
return "job scheduled on GitHub side; try again later"
|
||||
}
|
||||
|
||||
// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
|
||||
// "documentation_url" field value equal to "https://developer.github.com/v3#abuse-rate-limits".
|
||||
type AbuseRateLimitError struct {
|
||||
@@ -576,19 +564,14 @@ func (e *Error) Error() string {
|
||||
}
|
||||
|
||||
// CheckResponse checks the API response for errors, and returns them if
|
||||
// present. A response is considered an error if it has a status code outside
|
||||
// the 200 range or equal to 202 Accepted.
|
||||
// API error responses are expected to have either no response
|
||||
// present. A response is considered an error if it has a status code outside
|
||||
// the 200 range. API error responses are expected to have either no response
|
||||
// body, or a JSON response body that maps to ErrorResponse. Any other
|
||||
// response body will be silently ignored.
|
||||
//
|
||||
// The error type will be *RateLimitError for rate limit exceeded errors,
|
||||
// *AcceptedError for 202 Accepted status codes,
|
||||
// and *TwoFactorAuthError for two-factor authentication errors.
|
||||
func CheckResponse(r *http.Response) error {
|
||||
if r.StatusCode == http.StatusAccepted {
|
||||
return &AcceptedError{}
|
||||
}
|
||||
if c := r.StatusCode; 200 <= c && c <= 299 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user