{"modulePath":"github.com/asteroid-computing/go-lambda-edge","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package actionheader\n\nPackage actionheader selects one application action from a configured HTTP request header. It uses only the standard library, so native HTTP servers and Lambda adapters can share the same selection rules. Consumers own action metadata, registry lookup, authorization and HTTP responses.\n\n## Variables\n\n```go\nvar (\n\t// ErrMissing means the configured header has no represented values.\n\t// An absent header and a nil or empty value slice are all missing.\n\tErrMissing = errors.New(\"actionheader: missing action\")\n\n\t// ErrAmbiguous means the header has multiple represented values or a value containing a comma.\n\t// Gateway payload 2.0 combines duplicates with commas;\n\t// a literal comma cannot be distinguished from combined values.\n\tErrAmbiguous = errors.New(\"actionheader: ambiguous action\")\n\n\t// ErrInvalid means the single action value is empty after trimming outer spaces and tabs, or does not satisfy the HTTP token grammar.\n\tErrInvalid = errors.New(\"actionheader: invalid action\")\n)\n```\n\n## Types\n\n```go\ntype Selector struct {\n\t// contains filtered or unexported fields\n}\n```\nSelector selects an action from a configured request header. Construct it with [NewSelector](#NewSelector); its zero value is unconfigured. A Selector is immutable, safe to copy, and safe for concurrent use.\n\n```go\nfunc NewSelector(name string) (Selector, error)\n```\nNewSelector validates name as an HTTP field name and returns a selector. The name is required and matched case-insensitively; no default is inferred. On error, the returned selector is the zero value. Configuration errors are separate from [ErrMissing](#ErrMissing), [ErrAmbiguous](#ErrAmbiguous) and [ErrInvalid](#ErrInvalid).\n\n```go\nfunc (s Selector) Parse(headers http.Header) (string, error)\n```\nParse returns the single action in headers, trimming only outer SP/HTAB and preserving case. An action must be a nonempty HTTP token (RFC 9110 §5.6.2). Parse inspects all case-insensitive aliases, including noncanonical map keys. Multiple values are ambiguous even if identical; a comma is also ambiguous. Multiplicity and comma checks take precedence over token validation. Duplicates already lost by a gateway or earlier proxy cannot be detected.\n\nOn failure Parse returns an empty string and [ErrMissing](#ErrMissing), [ErrAmbiguous](#ErrAmbiguous) or [ErrInvalid](#ErrInvalid), matchable with [errors.Is](/errors#Is). An unconfigured selector instead returns a configuration error. Errors do not include supplied header values. Parse does not modify headers or write an HTTP response. Callers must not mutate headers concurrently with Parse. Select once and use that same action for authorization and execution.\n\n","path":"github.com/asteroid-computing/go-lambda-edge/actionheader","name":"actionheader","synopsis":"Package actionheader selects one application action from a configured HTTP request header.","isRedistributable":true}
