middlewares

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors

func Cors(configuration CorsConfiguration) there.Middleware

func Gzip added in v2.2.1

func Gzip(request there.Request, next there.Response) there.Response

func Logger added in v2.2.1

func Logger(configuration ...LoggerConfiguration) func(request there.Request, next there.Response) there.Response

func Recoverer

func Recoverer(request there.Request, next there.Response) there.Response

func RequireHeader added in v2.2.1

func RequireHeader(key string, value string) func(request there.Request, next there.Response) there.Response

RequireHeader is a middleware, that forces incoming requests to have a specific header. If this method is not used, only Status with status StatusBadRequest is returned.

func RequireHost added in v2.2.1

func RequireHost(host string) func(request there.Request, next there.Response) there.Response

RequireHost is a middleware, that forces incoming requests to have a specific host header set. If this header is not set, the String response with StatusBadRequest and the message "Invalid host for access to resource" is returned.

func Sanitizer added in v2.2.1

func Sanitizer(request there.Request, next there.Response) there.Response

func Skip added in v2.2.1

func Skip(handler there.Middleware, exclude func(request there.Request) bool) there.Middleware

Types

type CorsConfiguration

type CorsConfiguration struct {
	AccessControlAllowOrigin  string
	AccessControlAllowMethods string
	AccessControlAllowHeaders string
}

func CorsAllowAllConfiguration added in v2.2.1

func CorsAllowAllConfiguration() CorsConfiguration

type LoggerConfiguration added in v2.2.1

type LoggerConfiguration struct {
	InfoLogger  *log.Logger
	ErrorLogger *log.Logger
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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