middleware

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth added in v0.4.0

func Auth(token string) gin.HandlerFunc

Auth validates the Bearer token in the Authorization header. If token is empty, auth is disabled and all requests pass through.

func Logger

func Logger() gin.HandlerFunc

Logger logs request details using structured logging

func Metrics

func Metrics() gin.HandlerFunc

Metrics records request metrics

func Recovery

func Recovery() gin.HandlerFunc

Recovery recovers from panics and logs them

func RequestID

func RequestID() gin.HandlerFunc

RequestID adds a unique request ID to each request

func RequestSizeLimit

func RequestSizeLimit(maxBytes int64) gin.HandlerFunc

RequestSizeLimit limits the request body size

func SetCacheHeaders

func SetCacheHeaders(c *gin.Context, cfg *CacheHeadersConfig)

SetCacheHeaders sets cache-related response headers

Types

type CacheHeadersConfig

type CacheHeadersConfig struct {
	CacheHit bool
	Score    float32
	CacheKey string
	Provider string
}

CacheHeaders adds cache-related headers to responses

Jump to

Keyboard shortcuts

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