This commit is contained in:
telanflow
2020-08-12 14:32:04 +08:00
parent e81a17de66
commit 6b38075276

View File

@@ -6,12 +6,15 @@ import (
"strings"
)
// Filter is an request interceptor
type Filter interface {
Match(req *http.Request) bool
}
// A wrapper that would convert a function to a Filter interface type
type FilterFunc func(req *http.Request) bool
// Filter.Match(req) <=> FilterFunc(req)
func (f FilterFunc) Match(req *http.Request) bool {
return f(req)
}