middleware

package
v0.0.0-...-c486877 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 21 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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