Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneRequest ¶ added in v0.7.0
CloneRequest creates a clone of an HTTP request with its body preserved. This is useful for retrying requests, as the body can only be read once.
If req.GetBody is set (e.g., by http.NewRequest), it uses that to recreate the body. Otherwise, it reads the body, restores the original, and sets the clone's body.
Types ¶
type ChatuinoRoundTrip ¶
type ChatuinoRoundTrip struct {
// contains filtered or unexported fields
}
func NewChatuinoRoundTrip ¶
func NewChatuinoRoundTrip(rt http.RoundTripper, logger zerolog.Logger, userAgentVersion string) *ChatuinoRoundTrip
type RateLimitRetryTransport ¶ added in v0.7.0
type RateLimitRetryTransport struct {
// Transport is the underlying http.RoundTripper
Transport http.RoundTripper
// SkipEndpoints lists endpoint paths that should NOT be retried on 429
SkipEndpoints []string
}
RateLimitRetryTransport is an http.RoundTripper that automatically retries requests that receive a 429 (Too Many Requests) response by waiting until the time specified in the Ratelimit-Reset header.
Click to show internal directories.
Click to hide internal directories.