s3manager-web/adapters/adapter.go
2017-03-30 22:48:27 +02:00

15 lines
313 B
Go

package adapters
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
}