Add package-level doc comments for go doc and gopls
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
retry/doc.go
Normal file
31
retry/doc.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Package retry provides configurable HTTP request retry as client middleware.
|
||||
//
|
||||
// The retry middleware wraps an http.RoundTripper and automatically retries
|
||||
// failed requests based on a configurable policy, with exponential backoff
|
||||
// and optional jitter.
|
||||
//
|
||||
// # Usage
|
||||
//
|
||||
// mw := retry.Transport(
|
||||
// retry.WithMaxAttempts(3),
|
||||
// retry.WithBackoff(retry.ExponentialBackoff(100*time.Millisecond, 5*time.Second)),
|
||||
// )
|
||||
// transport := mw(http.DefaultTransport)
|
||||
//
|
||||
// # Retry-After
|
||||
//
|
||||
// The retry middleware respects the Retry-After response header. If a server
|
||||
// returns 429 or 503 with Retry-After, the delay from the header overrides
|
||||
// the backoff strategy.
|
||||
//
|
||||
// # Request bodies
|
||||
//
|
||||
// For requests with bodies to be retried, the request must have GetBody set.
|
||||
// Use httpx.NewJSONRequest or httpx.NewFormRequest which set GetBody
|
||||
// automatically.
|
||||
//
|
||||
// # Sentinel errors
|
||||
//
|
||||
// ErrRetryExhausted is returned when all attempts fail. The original error
|
||||
// is wrapped and accessible via errors.Unwrap.
|
||||
package retry
|
||||
Reference in New Issue
Block a user