From c6579488244eba856d7c9797b75b66e74cef991d Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sat, 28 Mar 2015 16:49:06 -0600 Subject: [PATCH] Refactored redir middleware to return errors --- middleware/redirect/redirect.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/middleware/redirect/redirect.go b/middleware/redirect/redirect.go index f59b3e800..e9ec79498 100644 --- a/middleware/redirect/redirect.go +++ b/middleware/redirect/redirect.go @@ -41,15 +41,15 @@ func New(c middleware.Controller) (middleware.Middleware, error) { redirects = append(redirects, rule) } - return func(next http.HandlerFunc) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(next middleware.HandlerFunc) middleware.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) (int, error) { for _, rule := range redirects { if r.URL.Path == rule.From { http.Redirect(w, r, rule.To, rule.Code) break } } - next(w, r) + return next(w, r) } }, nil }