All checks were successful
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 2m26s
14 lines
351 B
Go
14 lines
351 B
Go
package middleware
|
|
|
|
import "net/http"
|
|
|
|
func Wrapper(next http.Handler, handlers ...func(http.Handler) http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
lastHandler := next
|
|
for i := len(handlers) - 1; i >= 0; i-- {
|
|
lastHandler = handlers[i](lastHandler)
|
|
}
|
|
lastHandler.ServeHTTP(w, r)
|
|
})
|
|
}
|