middleware

package
v0.0.0-...-7a975dd Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDHeaderName = "X-Request-ID"

Variables

This section is empty.

Functions

func AccessLogMiddleware

func AccessLogMiddleware(logSuccessfulRequests, excludeRemoteAddr bool, excludedHeaderPatterns []string, next http.Handler) http.Handler

func CORSMiddleware

func CORSMiddleware(
	allowedOrigins []string,
	allowedMethods []string,
	allowedHeaders []string,
	disableCredentials bool,
	exposeHeaders []string,
	maxAge time.Duration,
	next http.Handler) http.HandlerFunc

func CommonHeadersMiddleware

func CommonHeadersMiddleware(next http.Handler) http.Handler

func GetRequestID

func GetRequestID(ctx context.Context) string

func LoggerMiddleware

func LoggerMiddleware(next http.Handler) http.Handler

func PathVariablesLoggerMiddleware

func PathVariablesLoggerMiddleware(next http.Handler, pathVariableNames ...string) http.Handler

func PostgresMiddleware

func PostgresMiddleware(pool *pgxpool.Pool, mode pgx.TxAccessMode, next http.Handler) http.Handler

func PreventCachingMiddleware

func PreventCachingMiddleware(next http.Handler) http.HandlerFunc

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.HandlerFunc

Types

type Handlers

type Handlers struct {
	OPTIONS http.Handler
	HEAD    http.Handler
	POST    http.Handler
	GET     http.Handler
	PUT     http.Handler
	PATCH   http.Handler
	DELETE  http.Handler
}

func (*Handlers) ServeHTTP

func (h *Handlers) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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