Documentation
¶
Overview ¶
Package idempotency provides idempotency utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware enforces Idempotency-Key semantics.
func (*Middleware) Handler ¶
func (m *Middleware) Handler(next http.Handler) http.Handler
Handler wraps the next handler with idempotency logic.
func (*Middleware) Middleware ¶
func (m *Middleware) Middleware() func(http.Handler) http.Handler
Middleware implements ports.Middleware via Handler adapter.
type Options ¶
type Options struct {
Store ports.IdempotencyStore
HeaderName string
KeyFunc KeyFunc
HashFunc HashFunc
TTL time.Duration
InFlightTTL time.Duration
MaxBodyBytes int64
Clock ports.Clock
ShouldHandle func(*http.Request) bool
ShouldStore func(status int) bool
ResponseHeaderAllow []string
ResponseHeaderDeny []string
ReplayHeaderName string
FailOpen bool
OnError func(error)
}
Options configures the idempotency middleware.
Click to show internal directories.
Click to hide internal directories.