middleware

package module
v0.0.0-...-f735b4e Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger *slog.Logger = NewLogger(os.Stdout)

Functions

func NewLogger

func NewLogger(w io.Writer) *slog.Logger

func SetUserID added in v0.0.3

func SetUserID(ctx context.Context, userID string) error

func UserID added in v0.0.4

func UserID(ctx context.Context) (string, error)

Types

type Middleware

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

func New

func New(writeErrorBody errorWriter, logger *slog.Logger) *Middleware

func (*Middleware) ContentType

func (m *Middleware) ContentType(contentTypes ...string) func(http.Handler) http.Handler

func (*Middleware) Log

func (m *Middleware) Log(next http.Handler) http.Handler

func (*Middleware) Recover

func (m *Middleware) Recover(h http.Handler) http.Handler

func (*Middleware) RequestSize

func (m *Middleware) RequestSize(maxBytes int64) func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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