github_ratelimit_test

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidBodyContent = `{"message": "not as expected"}`
)
View Source
const (
	SecondaryRateLimitMessage = `You have exceeded a secondary rate limit. Please wait a few minutes before you try again.`
)

Variables

View Source
var SecondaryRateLimitDocumentationURLs = []string{
	`https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits`,
	`https://docs.github.com/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits`,
	`https://docs.github.com/en/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits`,
}
View Source
var SecondaryRateLimitStatusCodes = []int{
	http.StatusForbidden,
	http.StatusTooManyRequests,
}

Functions

func IsInvalidBody added in v1.0.4

func IsInvalidBody(resp *http.Response) (bool, error)

Types

type SecondaryRateLimitInjecter

type SecondaryRateLimitInjecter struct {
	AbuseAttempts int
	// contains filtered or unexported fields
}

func (*SecondaryRateLimitInjecter) CurrentSleepEnd

func (r *SecondaryRateLimitInjecter) CurrentSleepEnd() time.Time

func (*SecondaryRateLimitInjecter) NextSleepStart

func (r *SecondaryRateLimitInjecter) NextSleepStart() time.Time

func (*SecondaryRateLimitInjecter) RoundTrip

func (t *SecondaryRateLimitInjecter) RoundTrip(request *http.Request) (*http.Response, error)

type SecondaryRateLimitInjecterOptions

type SecondaryRateLimitInjecterOptions struct {
	Every               time.Duration
	Sleep               time.Duration
	InvalidBody         bool
	UseXRateLimit       bool
	UsePrimaryRateLimit bool
	DocumentationURL    string
	HttpStatusCode      int
}

func (*SecondaryRateLimitInjecterOptions) IsNoop

func (*SecondaryRateLimitInjecterOptions) Validate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL