middleware

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 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 added in v1.7.0

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

Types

type AllowedMethodsHandler added in v1.8.0

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

func NewAllowedMethodsHandler added in v1.8.0

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

func (*AllowedMethodsHandler) Child added in v1.8.0

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

func (*AllowedMethodsHandler) MethodAllowed added in v1.8.0

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

func (*AllowedMethodsHandler) ServeHTTP added in v1.8.0

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 added in v1.7.0

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

func (*CustomLogs) ServeHTTP added in v1.7.0

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

func (*CustomLogs) String added in v1.7.0

func (c *CustomLogs) String() string

type MetricsHandler added in v1.12.0

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

func (*MetricsHandler) ServeHTTP added in v1.12.0

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 added in v1.12.0

func NewMetricsHandler() Next

func NewRecordHandler

func NewRecordHandler(secureCookies string) Next

func NewTraceHandler

func NewTraceHandler() 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