reqid

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package reqid holds the request-ID context plumbing shared between the middleware that mints the ID (internal/api) and the handlers that want to include it in audit log lines (internal/api/handlers). Lives in its own package so neither side has to import the other.

Index

Constants

View Source
const HeaderName = "X-Request-ID"

HeaderName is the request/response header that carries the per-request ID. Kept here so the middleware and the http client agree.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

FromContext returns the request ID associated with ctx, or "" if none was attached (e.g. tests calling a handler directly without going through the middleware).

func WithValue

func WithValue(ctx context.Context, id string) context.Context

WithValue attaches a request ID to ctx. Only the middleware should call this; handlers read via FromContext.

Types

This section is empty.

Jump to

Keyboard shortcuts

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