requestid

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Skip:      nil,
	Header:    kid.HeaderRequestId,
	Generator: nanoid.New,
}

Functions

func New

func New(config ...Config) kid.HandlerFunc

New creates a new middleware handler

Types

type Config

type Config struct {
	// Skip the middleware when this func return true.
	//
	// Optional. Default: nil
	Skip func(*kid.Ctx) bool

	// Header name that specify the id.
	//
	// Optional. Default: "X-Request-ID"
	Header string

	// Generator generates a new id.
	//
	// Optional. Default: nanoid
	Generator func() (string, error)
}

Jump to

Keyboard shortcuts

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