s3manager-web/adapters/adapter.go

16 lines
313 B
Go
Raw Normal View History

2017-03-30 22:48:27 +02:00
package adapters
2017-03-10 11:12:20 +01:00
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
}