middleware

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFileSpaAllowedMethods = []string{
	http.MethodGet,
	http.MethodHead,
}

Functions

func NewCORSHandler

func NewCORSHandler(opts *CORSOptions, nextHandler http.Handler) http.Handler

func NewCustomLogsHandler

func NewCustomLogsHandler(bodies []hcl.Body, next http.Handler, handlerName string) http.Handler

Types

type AllowedMethodsHandler

type AllowedMethodsHandler struct {
	// contains filtered or unexported fields
}

func NewAllowedMethodsHandler

func NewAllowedMethodsHandler(allowedMethods, defaultAllowedMethods []string, allowedHandler, notAllowedHandler http.Handler) *AllowedMethodsHandler

func (*AllowedMethodsHandler) Child

func (a *AllowedMethodsHandler) Child() http.Handler

func (*AllowedMethodsHandler) MethodAllowed

func (a *AllowedMethodsHandler) MethodAllowed(method string) bool

func (*AllowedMethodsHandler) ServeHTTP

func (a *AllowedMethodsHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type CORS

type CORS struct {
	// contains filtered or unexported fields
}

func (*CORS) Child

func (c *CORS) Child() http.Handler

func (*CORS) ServeHTTP

func (c *CORS) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*CORS) ServeNextHTTP

func (c *CORS) ServeNextHTTP(rw http.ResponseWriter, nextHandler http.Handler, req *http.Request)

type CORSOptions

type CORSOptions struct {
	AllowedOrigins   []string
	AllowCredentials bool
	MaxAge           string
	// contains filtered or unexported fields
}

func NewCORSOptions

func NewCORSOptions(cors *config.CORS, methodAllowed methodAllowedFunc) (*CORSOptions, error)

func (*CORSOptions) AllowsOrigin

func (c *CORSOptions) AllowsOrigin(origin string) bool

type CustomLogs

type CustomLogs struct {
	// contains filtered or unexported fields
}

func (*CustomLogs) ServeHTTP

func (c *CustomLogs) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*CustomLogs) String

func (c *CustomLogs) String() string

type MetricsHandler

type MetricsHandler struct {
	// contains filtered or unexported fields
}

func (*MetricsHandler) ServeHTTP

func (mh *MetricsHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Next

type Next func(http.Handler) *NextHandler

func NewErrorHandler

func NewErrorHandler(condition condition, eh http.Handler) Next

func NewMetricsHandler

func NewMetricsHandler() Next

func NewRecordHandler

func NewRecordHandler(secureCookies string) Next

func NewTraceHandler

func NewTraceHandler(parentOnly, trustParent bool) Next

func NewUIDHandler

func NewUIDHandler(conf *config.Settings, devProxy string) Next

type NextHandler

type NextHandler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(handler, next http.Handler) *NextHandler

func (*NextHandler) Child

func (n *NextHandler) Child() http.Handler

func (*NextHandler) ServeHTTP

func (n *NextHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type TraceHandler

type TraceHandler struct {
	// contains filtered or unexported fields
}

func (*TraceHandler) ServeHTTP

func (th *TraceHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type UID

type UID struct {
	// contains filtered or unexported fields
}

func (*UID) ServeHTTP

func (u *UID) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP generates a unique request-id and add this id to the request context and at least the response header even on error case.

type UIDFunc

type UIDFunc func() string

UIDFunc wraps different unique id implementations.

func NewUIDFunc

func NewUIDFunc(requestIDFormat string) UIDFunc

Jump to

Keyboard shortcuts

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