middleware

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServerHeader = "indigo"

Variables

This section is empty.

Functions

func CustomContext added in v0.13.0

func CustomContext(ctx context.Context) inbuilt.Middleware

func HTTPSOnly added in v0.10.2

func HTTPSOnly(optionalParams ...HTTPOnlyParams) inbuilt.Middleware

HTTPSOnly redirects all http requests to https. In case no Host header is provided, 400 Bad Request will be returned without calling the actual handler.

func LogRequests added in v0.13.0

func LogRequests(loggers ...Logger) inbuilt.Middleware

func Recover

func Recover(next inbuilt.Handler, req *http.Request) (resp *http.Response)

Recover is a basic middleware that catches any panics, logs it and returns 500 Internal Server Error

func Redirect added in v0.13.0

func Redirect(from, to string) inbuilt.Middleware

func ServerHeader added in v0.15.8

func ServerHeader(customHeaders ...string) inbuilt.Middleware

Types

type HTTPOnlyParams added in v0.16.0

type HTTPOnlyParams struct {
	// RedirectTo defines the host, where the user will be redirected.
	// If empty, value from Host header will be used
	RedirectTo string
	// Port is added to the host value.
	// If empty, implicitly default 443 port will be used
	Port string
}

type Logger added in v0.13.0

type Logger interface {
	Printf(fmt string, v ...any)
}

Jump to

Keyboard shortcuts

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