package myth

import (
	"net/http"
)

// Middleware http middleware
type Middleware func(http.HandlerFunc) http.HandlerFunc

// MiddlewareChain applies middlewares to a http.HandlerFunc
func MiddlewareChain(fn http.HandlerFunc, mws ...Middleware) http.HandlerFunc {
	for _, m := range mws {
		fn = m(fn)
	}
	return fn
}