linstrom/web/public/middleware/SaveFullPath.go
mstar 271acc8d29
All checks were successful
/ docker (push) Successful in 4m8s
Forgot those
2025-04-20 22:10:55 +02:00

17 lines
360 B
Go

package webmiddleware
import (
"context"
"net/http"
)
const FullPathContextKey KeyType = "request-full-path"
func AppendFullPathMiddleware(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
h.ServeHTTP(
w,
r.WithContext(context.WithValue(r.Context(), FullPathContextKey, r.URL.Path)),
)
})
}