middleware

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 13 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(realm string, credentials map[string]string) zoox.Middleware

BasicAuth is a middleware that authenticates via Basic Auth.

func CORS added in v1.0.20

func CORS(cfg ...*CorsConfig) zoox.Middleware

CORS is a middleware for handling CORS (Cross-Origin Resource Sharing)

func HealthCheck

func HealthCheck() zoox.Middleware

HealthCheck is a middleware that checks the health of the application.

func Jwt added in v1.0.25

func Jwt(secret string, algorithm ...string) zoox.Middleware

Jwt is a middleware that authenticates via JWT.

func Logger

func Logger() zoox.Middleware

Logger is a middleware that logs the request as it goes through the handler.

func RealIP

func RealIP() zoox.Middleware

RealIP is a middleware that adds a "X-Real-IP" header to the request.

func Recovery

func Recovery() zoox.Middleware

Recovery is the recovery middleware

func RequestID added in v1.1.2

func RequestID() zoox.Middleware

RequestID is a middleware that adds a request ID to the context.

func Rewrite added in v1.0.20

func Rewrite(cfg ...*RewriteConfig) zoox.Middleware

Rewrite is a middleware that rewrites the request path.

func Timeout

func Timeout(timeout time.Duration) zoox.Middleware

Timeout is a middleware that sets a timeout for the request.

Types

type CorsConfig added in v1.0.20

type CorsConfig struct {
	IgnoreFunc       func(ctx *zoox.Context) bool
	AllowOrigins     []string
	AllowOriginFunc  func(origin string) bool
	AllowMethods     []string
	AllowHeaders     []string
	AllowCredentials bool
	ExposeHeaders    []string
}

CorsConfig is the configuration for the CORS middleware.

func DefaultCorsConfig added in v1.0.20

func DefaultCorsConfig() *CorsConfig

DefaultCorsConfig is the default CORS configuration.

type RewriteConfig added in v1.0.20

type RewriteConfig struct {
	Rewrites map[string]string
}

RewriteConfig is the configuration for the Rewrite middleware.

Jump to

Keyboard shortcuts

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