middleware

package
v0.0.0-...-c407d37 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextLogger

func ContextLogger(field string, original *zap.Logger) func(next http.Handler) http.Handler

ContextLogger returns a handler that injects the logger into the request context.

func LimitBodySize

func LimitBodySize(maxBodySize int64, logger *zap.Logger) func(inner http.Handler) http.Handler

LimitBodySize is a middleware

func NoCache

func NoCache() func(inner http.Handler) http.Handler

NoCache sets the Cache-Cotnrol header so this route is never cached by clients.

func OpenAPITracing

func OpenAPITracing(api OpenAPIWithContext) func(next http.Handler) http.Handler

OpenAPITracing instruments a context with the path pattern for the request. This is useful for recording metrics

func Recovery

func Recovery(globalLogger *zap.Logger) func(inner http.Handler) http.Handler

Recovery recovers from a panic within a handler.

func RequestLogger

func RequestLogger() func(inner http.Handler) http.Handler

RequestLogger returns a middleware that logs requests.

func SecurityHeaders

func SecurityHeaders(globalLogger *zap.Logger) func(inner http.Handler) http.Handler

SecurityHeaders adds a set of standard security headers.

func Trace

func Trace(telemetryConfig *telemetry.Config) func(next http.Handler) http.Handler

Trace returns a trace middleware that injects a unique trace id into every request.

Types

type OpenAPIWithContext

type OpenAPIWithContext interface {
	Context() *middleware.Context
}

OpenAPIWithContext descripes an API that implements go-openapi Context method

Jump to

Keyboard shortcuts

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