s3manager-web/adapters.go
2017-03-10 11:12:20 +01:00

15 lines
309 B
Go

package main
import "net/http"
// Adapter is an HTTP middleware
type Adapter func(http.Handler) http.Handler
// Adapt applies adapters to an HTTP handler function
func Adapt(h http.Handler, adapters ...Adapter) http.Handler {
for i := len(adapters) - 1; i >= 0; i-- {
h = adapters[i](h)
}
return h
}