handlers

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestID contextValue = "request_id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomResponseWriter

type CustomResponseWriter struct {
	http.ResponseWriter
	Status       int
	BytesWritten int
}

func NewCustomResponseWriter

func NewCustomResponseWriter(w http.ResponseWriter) *CustomResponseWriter

func (*CustomResponseWriter) Write

func (w *CustomResponseWriter) Write(b []byte) (int, error)

func (*CustomResponseWriter) WriteHeader

func (w *CustomResponseWriter) WriteHeader(statusCode int)

type Middleware

type Middleware func(handler http.Handler) http.Handler

func WithGzipHandler

func WithGzipHandler() Middleware

func WithHeaders

func WithHeaders(headers http.Header) Middleware

func WithPathStrip

func WithPathStrip(logger logrus.FieldLogger, path string) Middleware

WithPathStrip strips the path from the request URL, paths always start with a /.

func WithRateLimiter added in v0.0.9

func WithRateLimiter(logger logrus.FieldLogger, b TakeMaxDuration, maxDelay time.Duration) Middleware

func WithRequestLogger

func WithRequestLogger(logger logrus.FieldLogger) Middleware

type TakeMaxDuration

type TakeMaxDuration interface {
	TakeMaxDuration(count int64, maxWait time.Duration) (time.Duration, bool)
}

Jump to

Keyboard shortcuts

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