package assetserver import ( "net/http" ) // Middleware defines a HTTP middleware that can be applied to the AssetServer. // The handler passed as next is the next handler in the chain. One can decide to call the next handler // or implement a specialized handling. type Middleware func(next http.Handler) http.Handler // ChainMiddleware allows chaining multiple middlewares to one middleware. func ChainMiddleware(middleware ...Middleware) Middleware { return func(h http.Handler) http.Handler { for i := len(middleware) - 1; i >= 0; i-- { h = middleware[i](h) } return h } }