requestid

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package requestid provides shared request ID helpers used by Credo's built-in and configurable middleware implementations.

Index

Constants

View Source
const (
	// Key is the request-scoped store key used for the current request ID.
	Key = "credo.requestid"

	// Header is the default HTTP header used to read and write the request ID.
	Header = "X-Request-Id"

	// DefaultLimit is the default maximum accepted request ID length.
	DefaultLimit = 64
)

Variables

This section is empty.

Functions

func Generate

func Generate() string

Generate creates a 128-bit cryptographically random base32 request ID.

func IsValid

func IsValid(id string) bool

IsValid reports whether id contains only safe header/log characters.

func Resolve

func Resolve(value string, limit int, generator func() string) string

Resolve returns the incoming request ID when it is valid, or a generated replacement otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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