requestid

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRequestIDGenerator

func DefaultRequestIDGenerator(r *http.Request) string

func Get

func Get(ctx context.Context) string

Get returns queryid

func RequestID

func RequestID(next http.Handler, opts ...Option) http.Handler

RequestID middleware adds a unique request id to the request context

func WithDefaultQueryID

func WithDefaultQueryID(ctx context.Context) context.Context

WithDefaultQueryID puts to the context default queryid

func WithQueryID

func WithQueryID(ctx context.Context, queryid string) context.Context

WithQueryID puts to the context queryid

Types

type Option

type Option func(*config)

func WithCloudflareRequestID

func WithCloudflareRequestID() Option

WithCloudflareRequestID sets external id getter to get request id from cloudflare headers

func WithExternalIDGetter

func WithExternalIDGetter(getter func(r *http.Request) string) Option

WithExternalIDGetter sets external id getter

func WithExternalIDHeaders

func WithExternalIDHeaders(headers ...string) Option

WithExternalIDHeaders sets headers to get external id from

func WithHeaderName

func WithHeaderName(name string) Option

WithHeaderName sets header name to put queryid to

func WithQueryIDGenerator

func WithQueryIDGenerator(generator func(r *http.Request) string) Option

WithQueryIDGenerator sets queryid generator

Jump to

Keyboard shortcuts

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