middleware

package
v2.260.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthcheckFilter

func HealthcheckFilter(hcHandler func(w http.ResponseWriter, req *http.Request)) map[string]Allowed

HealthcheckFilter creates a map for healthcheck endpoints whitelisting, to be provided to the Whitelist generic function

func Whitelist

func Whitelist(whitelist map[string]Allowed) func(h http.Handler) http.Handler

Whitelist creates a middleware that executes whitelisted endpoints The provided whitelist is keyed by path, and contains the handler to use and the methods for which the whitelist applies

Types

type Allowed

type Allowed struct {
	Methods []string
	Handler func(w http.ResponseWriter, req *http.Request)
}

Allowed provides a list of methods for which the handler should be executed

Jump to

Keyboard shortcuts

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