middleware

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler

func ClientSessionID

func ClientSessionID(next http.Handler) http.Handler

func Gzip

func Gzip(next http.Handler) http.Handler

func Logger

func Logger(base *slog.Logger) func(http.Handler) http.Handler

Must run AFTER ID context setting middlewares.

func Logging

func Logging(next http.Handler) http.Handler

func Recovery

func Recovery(next http.Handler) http.Handler

func RequestID

func RequestID(opts ...RequestIDOption) func(http.Handler) http.Handler

func SecurityHeaders

func SecurityHeaders(next http.Handler) http.Handler

func ShutdownContext

func ShutdownContext(next http.Handler) http.Handler

ShutdownContext is middleware that detects when the base context has been cancelled (indicating server shutdown) and marks the request context accordingly.

This allows handlers to distinguish between client disconnects and server-initiated shutdowns, enabling different logging and cleanup behavior.

func VersionCheck

func VersionCheck(next http.Handler) http.Handler

Types

type RequestIDMiddleware

type RequestIDMiddleware struct {
	IDFunc func(*http.Request) string
}

type RequestIDOption

type RequestIDOption func(*RequestIDMiddleware)

Jump to

Keyboard shortcuts

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