middleware

package
v0.0.0-...-b1c0688 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestIDHeader is a constant containing the request header key
	RequestIDHeader = "X-Request-ID"

	// RequestCtxKey is a context containing the context key under which the
	// request ID is stored.
	RequestCtxKey = contextKey("requestID")
)

Variables

This section is empty.

Functions

func MetricsMiddleware

func MetricsMiddleware(namespace, subsystem string, registerer prometheus.Registerer) func(http.Handler) http.Handler

MetricsMiddleware returns a new middleware that can then be Used by goji, or any other standard http.Handler based server.

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

RequestIDMiddleware is a net.http middleware that adds a unique UUID request ID to requests. If a request ID is already present in the request we use that one else we generate a random UUID. The request ID is added to our context so will be available within any downstream handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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