Documentation
¶
Index ¶
Constants ¶
View Source
const RequestIDKey requestIDKey = "custom.requestID"
RequestIDKey define a constant string for the request ID key
Variables ¶
View Source
var DefaultRequestIDConfig = Config{ Generator: generator, TargetHeader: echo.HeaderXRequestID, }
DefaultRequestIDConfig is the default RequestID middleware config.
Functions ¶
func GetContextRequestID ¶
GetContextRequestID takes a context as input and returns a pointer to a string of strings
func NewWithConfig ¶
func NewWithConfig(config Config) echo.MiddlewareFunc
NewWithConfig returns a X-Request-ID middleware with config.
Types ¶
type Config ¶
type Config struct {
// Generator defines a function to generate an ID.
// Optional. Defaults to generator for random string of length 32.
Generator func() string
// RequestIDHandler defines a function which is executed for a request id.
RequestIDHandler func(echo.Context, string)
// TargetHeader defines what header to look for to populate the id
TargetHeader string
}
Config defines the config for RequestID middleware.
Click to show internal directories.
Click to hide internal directories.