goutils/http/chain.go
mstar 18bf623114
Restructure all http related files
Moving all http related functions and helpers into a new http submodule
2025-03-04 13:56:57 +01:00

16 lines
267 B
Go

package http
import (
"net/http"
"slices"
)
type HandlerBuilder func(http.Handler) http.Handler
func ChainMiddlewares(base http.Handler, links ...HandlerBuilder) http.Handler {
slices.Reverse(links)
for _, f := range links {
base = f(base)
}
return base
}