This commit is contained in:
telanflow
2020-08-09 02:38:46 +08:00
parent ce279490b8
commit 1b6a370f99
27 changed files with 1331 additions and 137 deletions

View File

@@ -2,6 +2,12 @@ package mps
import "net/http"
type Middleware func(req *http.Request, resp *http.Response)
type Middleware interface {
Handle(req *http.Request, ctx *Context) (*http.Response, error)
}
type a http.HandlerFunc
type MiddlewareFunc func(req *http.Request, ctx *Context) (*http.Response, error)
func (f MiddlewareFunc) Handle(req *http.Request, ctx *Context) (*http.Response, error) {
return f(req, ctx)
}