zmiddlewares

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIDHeader = "X-Request-ID"
)

Variables

This section is empty.

Functions

func CacheMiddleware added in v0.14.2

func CacheMiddleware(cache zcache.ZCache, config domain.CacheConfig) func(next http.Handler) http.Handler

func LoggingMiddleware added in v0.14.4

func LoggingMiddleware(next http.Handler) http.Handler

func RegisterRequestMetrics

func RegisterRequestMetrics(appName string, metricsServer metrics.TaskMetrics) []error

Types

type CorsOptions

type CorsOptions struct {
	AllowedOrigins     []string
	AllowOriginFunc    func(r *http.Request, origin string) bool
	AllowedMethods     []string
	AllowedHeaders     []string
	ExposedHeaders     []string
	AllowCredentials   bool
	MaxAge             int
	OptionsPassthrough bool
	Debug              bool
}

type Middleware

type Middleware func(next http.Handler) http.Handler

func Cors

func Cors(options CorsOptions) Middleware

func DefaultCors

func DefaultCors() Middleware

func ErrorHandlerMiddleware

func ErrorHandlerMiddleware() Middleware

func Logger

func Logger() Middleware

func RateLimit

func RateLimit(maxRPM int) Middleware

func RateLimitByFullPath added in v0.10.2

func RateLimitByFullPath(maxRPM int) Middleware

func RequestID

func RequestID() Middleware

func RequestMetrics

func RequestMetrics(appName string, metricsServer metrics.TaskMetrics) Middleware

Jump to

Keyboard shortcuts

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