Request ID Middleware

Request ID middleware generates a unique id for a request.

Usage

e.Use(middleware.RequestID())

Custom Configuration

Usage

  1. e.Use(middleware.RequestIDWithConfig(middleware.RequestIDConfig{
  2. Generator: func() string {
  3. return customGenerator()
  4. },
  5. }))

Configuration

  1. RequestIDConfig struct {
  2. // Skipper defines a function to skip middleware.
  3. Skipper Skipper
  4. // Generator defines a function to generate an ID.
  5. // Optional. Default value random.String(32).
  6. Generator func() string
  7. }

Default Configuration

  1. DefaultRequestIDConfig = RequestIDConfig{
  2. Skipper: DefaultSkipper,
  3. Generator: generator,
  4. }