Now worky
This commit is contained in:
15
routes/path_middleware.go
Normal file
15
routes/path_middleware.go
Normal file
@ -0,0 +1,15 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"gitea.henriburau.de/haw-lan/cod4watcher/views"
|
||||
)
|
||||
|
||||
func PathMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := context.WithValue(r.Context(), views.PathContext, r.URL.Path)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user