Documentation
¶
Index ¶
- func AddOperationIdToContext() oasapi.Middleware
- func Chain(h http.Handler, mws ...func(http.Handler) http.Handler) http.Handler
- func GetOperationIDContext(ctx context.Context) (string, bool)
- func GetRequestIDContext(ctx context.Context) (string, bool)
- func UserAgentFromContext(ctx context.Context) (*domain.UserAgent, bool)
- func WithLogging(next http.Handler) http.Handler
- func WithOperationIDContext(ctx context.Context, operationID string) context.Context
- func WithRequestContext(ctx context.Context, rc RequestContext) context.Context
- func WithRequestContextMiddleware(generator RequestIDGenerator, next http.Handler) http.Handler
- func WithRequestIDContext(ctx context.Context, id string) context.Context
- func WithUserAgentMiddleware(next http.Handler) http.Handler
- type RequestContext
- type RequestIDGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOperationIdToContext ¶
func AddOperationIdToContext() oasapi.Middleware
func Chain ¶
Chain applies mws to h so the first listed runs outermost — first to see the request, last to see the response — matching the top-to-bottom reading order of the equivalent nested wrapping.
func UserAgentFromContext ¶
UserAgentFromContext returns the device context injected by WithUserAgentMiddleware.
func WithOperationIDContext ¶
WithOperationIDContext adds the given operation ID to the given context. The value is wrapped in struct so that it can be set downstream and retrieved upstream in the callstack. If a wrapper already exists in the context, its value is set instead of creating a new wrapper.
func WithRequestContext ¶
func WithRequestContext(ctx context.Context, rc RequestContext) context.Context
func WithRequestContextMiddleware ¶
func WithRequestContextMiddleware(generator RequestIDGenerator, next http.Handler) http.Handler
WithRequestContextMiddleware mints request_id, stores RequestContext, and echoes X-Request-Id.
func WithRequestIDContext ¶
Types ¶
type RequestContext ¶
RequestContext carries server-authoritative correlation fields for Path A/B events.
func GetRequestContext ¶
func GetRequestContext(ctx context.Context) (RequestContext, bool)
type RequestIDGenerator ¶
RequestIDGenerator mints correlation ids for HTTP requests (not resource PKs).