Refactor: Middleware chain uses Handler instead of HandlerFunc

This commit is contained in:
Matthew Holt
2015-04-02 23:30:54 -06:00
parent db2cd9e941
commit d33256f1dc
15 changed files with 80 additions and 71 deletions

View File

@ -26,8 +26,8 @@ func New(c middleware.Controller) (middleware.Middleware, error) {
rules = append(rules, rule)
}
return func(next middleware.HandlerFunc) middleware.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) (int, error) {
return func(next middleware.Handler) middleware.Handler {
return middleware.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {
servedFcgi := false
for _, rule := range rules {
@ -97,11 +97,11 @@ func New(c middleware.Controller) (middleware.Middleware, error) {
}
if !servedFcgi {
return next(w, r)
return next.ServeHTTP(w, r)
}
return 0, nil
}
})
}, nil
}