From 65a54206cae110d7efedc1b6776f6b641d491362 Mon Sep 17 00:00:00 2001 From: Cale Hoopes Date: Thu, 9 Mar 2017 12:27:04 -0800 Subject: [PATCH] Fixing shadowed `handlers` parameter - problem where I was overwriting the closure parameter which causes problems on multiple calls. --- rye.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rye.go b/rye.go index fa476e3..0385d6a 100644 --- a/rye.go +++ b/rye.go @@ -73,9 +73,9 @@ func (m *MWHandler) Use(handler Handler) { // The Handle function is the primary way to set up your chain of middlewares to be called by rye. // It returns a http.HandlerFunc from net/http that can be set as a route in your http server. -func (m *MWHandler) Handle(handlers []Handler) http.Handler { +func (m *MWHandler) Handle(customHandlers []Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - handlers := append(m.beforeHandlers, handlers...) + handlers := append(m.beforeHandlers, customHandlers...) for _, handler := range handlers { var resp *Response