Documentation ¶
Index ¶
Constants ¶
View Source
const (
// HeaderKey is the HTTP header key used to stored idempotency keys
HeaderKey = "X-Idempotency-Key"
)
Variables ¶
View Source
var ( // ErrSeenBefore is returned when our http ResponseWriter has seen the idempotency key before ErrSeenBefore = errors.New("X-Idempotency-Key seen before") )
Functions ¶
func FromRequest ¶
FromRequest extracts the idempotency key from HTTP headers and records its presence in the provided Recorder.
A nil Recorder will always return idempotency keys as unseen.
func SeenBefore ¶
func SeenBefore(w http.ResponseWriter)
SeenBefore sets a HTTP response code as an error for previously seen idempotency keys.
Types ¶
Click to show internal directories.
Click to hide internal directories.