Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIdempotencyConfig = IdempotencyConfig{ Skipper: middleware.DefaultSkipper, Methods: []string{http.MethodPost}, KeyLookup: "header:X-Idempotency-Key", TTL: 24 * time.Hour, }
Functions ¶
func Idempotency ¶
func Idempotency() echo.MiddlewareFunc
func IdempotencyWithConfig ¶
func IdempotencyWithConfig(config IdempotencyConfig) echo.MiddlewareFunc
Types ¶
type IdempotencyConfig ¶
type IdempotencyConfig struct {
// Skipper defines a function to skip middleware.
Skipper middleware.Skipper
Rediser Rediser
// Methods defines a list of HTTP methods that should be works as idempotent.
// Optional. Default value []string{"POST"}.
Methods []string `yaml:"methods"`
// KeyLookup is a string in the form of "<source>:<name>" that is used
// to extract key from the request.
// Optional. Default value "header:X-Idempotency-Key".
// Possible values:
// - "header:<name>"
// - "query:<name>"
// - "form:<name>"
KeyLookup string `yaml:"key_lookup"`
KeyLookupFunc KeyExtractor
TTL time.Duration
}
IdempotencyConfig defines the config for Idempotency middleware.
Click to show internal directories.
Click to hide internal directories.