key

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package key provides strategies for generating idempotency keys from HTTP requests.

Available strategies:

HeaderBased: Extracts the key from a request header (e.g., "Idempotency-Key")

strategy := key.HeaderBased("Idempotency-Key")

BodyHash: Generates a key from the hash of the request content (method + path + body)

strategy := key.BodyHash()

Composite: Tries header-based first, falls back to body hash if header is not present

strategy := key.Composite("Idempotency-Key")

Package key provides strategies for generating idempotency keys from HTTP requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyHash

func BodyHash() idempotency.KeyStrategy

BodyHash creates a key strategy that generates a key from the request body hash The key is computed as: SHA256(method + path + body)

func Composite

func Composite(headerName string) idempotency.KeyStrategy

Composite creates a key strategy that combines header-based key with request hash If header is present, uses it; otherwise falls back to body hash

func HeaderBased

func HeaderBased(headerName string) idempotency.KeyStrategy

HeaderBased creates a key strategy that extracts the key from a request header

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL