middleware

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCORS

func AddCORS(to http.Handler, opts AddCORSOpts) http.Handler

func AddObservability added in v0.4.0

func AddObservability(to http.Handler, opts AddObservabilityOpts) http.Handler

func AddSessionContext

func AddSessionContext(to http.Handler, opts AddSessionContextOpts) (http.Handler, error)

Types

type AddCORSOpts

type AddCORSOpts struct {
	AllowedMethods   []string
	AllowedOrigins   []string
	AllowCredentials bool
}

type AddObservabilityOpts added in v0.4.0

type AddObservabilityOpts struct {
	Logger   FormattedLogger
	Recorder MetricsRecorder
}

type AddSessionContextOpts

type AddSessionContextOpts struct {
	CookieID             string
	ErrorLogger          func(string, ...interface{})
	SessionTokenConsumer func(string) (map[string]interface{}, error)
	SessionTokenProvider func(interface{}, *http.Request) *http.Request
}

func (AddSessionContextOpts) Validate

func (o AddSessionContextOpts) Validate() error

type FormattedLogger

type FormattedLogger func(string, ...interface{})

type Metrics added in v0.4.0

type Metrics struct {
	RequestMethod string
	RequestPath   string
	ResponseCode  int
}

type MetricsRecorder added in v0.4.0

type MetricsRecorder func(Metrics)

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	ResponseSize int
	Status       int
}

func (ResponseWriter) Header

func (rw ResponseWriter) Header() http.Header

func (*ResponseWriter) Write

func (rw *ResponseWriter) Write(output []byte) (int, error)

func (*ResponseWriter) WriteHeader

func (rw *ResponseWriter) WriteHeader(status int)

Jump to

Keyboard shortcuts

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