From f4a2452a946b0d30f32b8698ca1291bddab1c7f3 Mon Sep 17 00:00:00 2001 From: Ankit Patial Date: Sun, 3 Nov 2024 22:33:56 +0530 Subject: [PATCH] removed proxy func, need to revist it again --- router.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/router.go b/router.go index ad13ced..a247006 100644 --- a/router.go +++ b/router.go @@ -144,23 +144,7 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { r.mux.ServeHTTP(w, req) } -// Proxy are request and -func (r *Router) Proxy(w http.ResponseWriter, req *http.Request) { - if r == nil { - panic("mux: method ServeHTTP called on nil") - } - - h, pattern := r.mux.Handler(req) - if pattern == "" { - http.Error(w, "Not Found", http.StatusNotFound) - return - } - - // ensure we run all the middlewares - h = stack(r.middlewares, h) - // serve - h.ServeHTTP(w, req) -} +// TODO: proxy for aws lambda // stack middlewares(http handler) in order they are passed (FIFO) func stack(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler {