summaryrefslogtreecommitdiffhomepage
path: root/middleware/pipe.go
blob: 4b5064d697a39200a1741fc9d67d8b35cf2d3c71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package middleware

import "net/http"

type Middleware func(http.Handler) http.Handler

func Pipe(xs ...Middleware) Middleware {
	return func(next http.Handler) http.Handler {
		for i := len(xs) - 1; i >= 0; i-- {
			next = xs[i](next)
		}
		return next
	}
}