diff --git a/bench_test.go b/bench_test.go index a875ee8..41d2c08 100644 --- a/bench_test.go +++ b/bench_test.go @@ -171,7 +171,7 @@ func BenchmarkGocraftWeb_Param(b *testing.B) { benchRequest(b, router, r) } func BenchmarkGoji_Param(b *testing.B) { - router := loadGojiSingle("GET", "/user/:name", httpHandlerFunc) + router := loadGojiSingle("GET", "/user/:name", gojiHandler) r, _ := http.NewRequest("GET", "/user/gordon", nil) benchRequest(b, router, r) @@ -268,9 +268,9 @@ func BenchmarkR2router_Param(b *testing.B) { // func BenchmarkRevel_Param(b *testing.B) { // router := loadRevelSingle("GET", "/user/:name", "RevelController.Handle") -// r, _ := http.NewRequest("GET", "/user/gordon", nil) -// benchRequest(b, router, r) -// } +// r, _ := http.NewRequest("GET", "/user/gordon", nil) +// benchRequest(b, router, r) +// } func BenchmarkRivet_Param(b *testing.B) { router := loadRivetSingle("GET", "/user/:name", rivetHandler) @@ -381,7 +381,7 @@ func BenchmarkGocraftWeb_Param5(b *testing.B) { benchRequest(b, router, r) } func BenchmarkGoji_Param5(b *testing.B) { - router := loadGojiSingle("GET", fiveColon, httpHandlerFunc) + router := loadGojiSingle("GET", fiveColon, gojiHandler) r, _ := http.NewRequest("GET", fiveRoute, nil) benchRequest(b, router, r) @@ -478,9 +478,10 @@ func BenchmarkR2router_Param5(b *testing.B) { // func BenchmarkRevel_Param5(b *testing.B) { // router := loadRevelSingle("GET", fiveColon, "RevelController.Handle") -// r, _ := http.NewRequest("GET", fiveRoute, nil) -// benchRequest(b, router, r) -// } +// r, _ := http.NewRequest("GET", fiveRoute, nil) +// benchRequest(b, router, r) +// } + func BenchmarkRivet_Param5(b *testing.B) { router := loadRivetSingle("GET", fiveColon, rivetHandler) @@ -519,6 +520,218 @@ func BenchmarkVulcan_Param5(b *testing.B) { // benchRequest(b, router, r) // } +// Param5Get: Like param5 but reading all the parameters + +func BenchmarkAce_Param5Get(b *testing.B) { + router := loadAceSingle("GET", fiveColon, aceHandleParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkAero_Param5Get(b *testing.B) { + router := loadAeroSingle("GET", fiveColon, aeroHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +func BenchmarkBear_Param5Get(b *testing.B) { + router := loadBearSingle("GET", fiveBrace, bearHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkBeego_Param5Get(b *testing.B) { + router := loadBeegoSingle("GET", fiveColon, beegoHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkBone_Param5Get(b *testing.B) { + router := loadBoneSingle("GET", fiveColon, http.HandlerFunc(boneHandlerParams)) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkChi_Param5Get(b *testing.B) { + router := loadChiSingle("GET", fiveBrace, chiHandleParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +func BenchmarkCloudyKitRouter_Param5Get(b *testing.B) { + router := loadCloudyKitRouterSingle("GET", fiveColon, cloudyKitRouterHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +func BenchmarkDenco_Param5Get(b *testing.B) { + router := loadDencoSingle("GET", fiveColon, dencoHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkEcho_Param5Get(b *testing.B) { + router := loadEchoSingle("GET", fiveColon, echoHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGin_Param5Get(b *testing.B) { + router := loadGinSingle("GET", fiveColon, ginHandleParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGocraftWeb_Param5Get(b *testing.B) { + router := loadGocraftWebSingle("GET", fiveColon, gocraftWebHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGoji_Param5Get(b *testing.B) { + router := loadGojiSingle("GET", fiveColon, gojiHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGojiv2_Param5Get(b *testing.B) { + router := loadGojiv2Single("GET", fiveColon, gojiv2HandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGoJsonRest_Param5Get(b *testing.B) { + handler := loadGoJsonRestSingle("GET", fiveColon, goJsonRestHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, handler, r) +} +func BenchmarkGoRestful_Param5Get(b *testing.B) { + router := loadGoRestfulSingle("GET", fiveBrace, goRestfulHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +func BenchmarkGorillaMux_Param5Get(b *testing.B) { + router := loadGorillaMuxSingle("GET", fiveBrace, gorillaHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkGowwwRouter_Param5Get(b *testing.B) { + router := loadGowwwRouterSingle("GET", fiveColon, http.HandlerFunc(gowwwRouterHandleParams)) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkHttpRouter_Param5Get(b *testing.B) { + router := loadHttpRouterSingle("GET", fiveColon, httpRouterHandleParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkHttpTreeMux_Param5Get(b *testing.B) { + router := loadHttpTreeMuxSingle("GET", fiveColon, httpTreeMuxHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkKocha_Param5Get(b *testing.B) { + handler := new(kochaHandler) + router := loadKochaSingle( + "GET", fiveColon, + handler, http.HandlerFunc(handler.Get), + ) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkLARS_Param5Get(b *testing.B) { + router := loadLARSSingle("GET", fiveColon, larsHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +func BenchmarkMacaron_Param5Get(b *testing.B) { + router := loadMacaronSingle("GET", fiveColon, macaronHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkMartini_Param5Get(b *testing.B) { + router := loadMartiniSingle("GET", fiveColon, martiniHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkPat_Param5Get(b *testing.B) { + router := loadPatSingle("GET", fiveColon, http.HandlerFunc(patHandlerParams)) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkPossum_Param5Get(b *testing.B) { + router := loadPossumSingle("GET", fiveColon, possumHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkR2router_Param5Get(b *testing.B) { + router := loadR2routerSingle("GET", fiveColon, r2routerHandleParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +// func BenchmarkRevel_Param5Get(b *testing.B) { +// router := loadRevelSingle("GET", fiveColon, "RevelController.Handle"Params) + +// r, _ := http.NewRequest("GET", fiveRoute, nil) +// benchRequest(b, router, r) +// } +func BenchmarkRivet_Param5Get(b *testing.B) { + router := loadRivetSingle("GET", fiveColon, rivetHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkTango_Param5Get(b *testing.B) { + router := loadTangoSingle("GET", fiveColon, tangoHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkTigerTonic_Param5Get(b *testing.B) { + router := loadTigerTonicSingle("GET", fiveBrace, tigerTonicHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkTraffic_Param5Get(b *testing.B) { + router := loadTrafficSingle("GET", fiveColon, trafficHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} +func BenchmarkVulcan_Param5Get(b *testing.B) { + router := loadVulcanSingle("GET", fiveColon, vulcanHandlerParams) + + r, _ := http.NewRequest("GET", fiveRoute, nil) + benchRequest(b, router, r) +} + +// func BenchmarkZeus_Param5Get(b *testing.B) { +// router := loadZeusSingle("GET", fiveColon, http.HandlerFunc(httpHandlerFuncParams)) + +// r, _ := http.NewRequest("GET", fiveRoute, nil) +// benchRequest(b, router, r) +// } + // Route with 20 Params (no write) const twentyColon = "/:a/:b/:c/:d/:e/:f/:g/:h/:i/:j/:k/:l/:m/:n/:o/:p/:q/:r/:s/:t" const twentyBrace = "/{a}/{b}/{c}/{d}/{e}/{f}/{g}/{h}/{i}/{j}/{k}/{l}/{m}/{n}/{o}/{p}/{q}/{r}/{s}/{t}" @@ -531,10 +744,11 @@ func BenchmarkAce_Param20(b *testing.B) { benchRequest(b, router, r) } func BenchmarkAero_Param20(b *testing.B) { - router := loadAeroSingle("GET", twentyBrace, aeroHandler) + //router := loadAeroSingle("GET", twentyColon, aeroHandler) + + //r, _ := http.NewRequest("GET", twentyRoute, nil) + //benchRequest(b, router, r) - r, _ := http.NewRequest("GET", twentyRoute, nil) - benchRequest(b, router, r) } func BenchmarkBear_Param20(b *testing.B) { router := loadBearSingle("GET", twentyBrace, bearHandler) @@ -591,7 +805,7 @@ func BenchmarkGocraftWeb_Param20(b *testing.B) { benchRequest(b, router, r) } func BenchmarkGoji_Param20(b *testing.B) { - router := loadGojiSingle("GET", twentyColon, httpHandlerFunc) + router := loadGojiSingle("GET", twentyColon, gojiHandler) r, _ := http.NewRequest("GET", twentyRoute, nil) benchRequest(b, router, r) @@ -688,9 +902,9 @@ func BenchmarkR2router_Param20(b *testing.B) { // func BenchmarkRevel_Param20(b *testing.B) { // router := loadRevelSingle("GET", twentyColon, "RevelController.Handle") -// r, _ := http.NewRequest("GET", twentyRoute, nil) -// benchRequest(b, router, r) -// } +// r, _ := http.NewRequest("GET", twentyRoute, nil) +// benchRequest(b, router, r) +// } func BenchmarkRivet_Param20(b *testing.B) { router := loadRivetSingle("GET", twentyColon, rivetHandler) @@ -737,7 +951,7 @@ func BenchmarkAce_ParamWrite(b *testing.B) { benchRequest(b, router, r) } func BenchmarkAero_ParamWrite(b *testing.B) { - router := loadAeroSingle("GET", "/user/:name", aeroHandlerTest) + router := loadAeroSingle("GET", "/user/:name", aeroHandlerWrite) r, _ := http.NewRequest("GET", "/user/gordon", nil) benchRequest(b, router, r) @@ -767,7 +981,7 @@ func BenchmarkChi_ParamWrite(b *testing.B) { benchRequest(b, router, r) } func BenchmarkCloudyKitRouter_ParamWrite(b *testing.B) { - router := loadCloudyKitRouterSingle("GET", "/user/:name", cloudyKitRouterHandler) + router := loadCloudyKitRouterSingle("GET", "/user/:name", cloudyKitRouterHandlerWrite) r, _ := http.NewRequest("GET", "/user/gordon", nil) benchRequest(b, router, r) @@ -797,7 +1011,7 @@ func BenchmarkGocraftWeb_ParamWrite(b *testing.B) { benchRequest(b, router, r) } func BenchmarkGoji_ParamWrite(b *testing.B) { - router := loadGojiSingle("GET", "/user/:name", gojiFuncWrite) + router := loadGojiSingle("GET", "/user/:name", gojiHandlerWrite) r, _ := http.NewRequest("GET", "/user/gordon", nil) benchRequest(b, router, r) @@ -894,9 +1108,9 @@ func BenchmarkR2router_ParamWrite(b *testing.B) { // func BenchmarkRevel_ParamWrite(b *testing.B) { // router := loadRevelSingle("GET", "/user/:name", "RevelController.HandleWrite") -// r, _ := http.NewRequest("GET", "/user/gordon", nil) -// benchRequest(b, router, r) -// } +// r, _ := http.NewRequest("GET", "/user/gordon", nil) +// benchRequest(b, router, r) +// } func BenchmarkRivet_ParamWrite(b *testing.B) { router := loadRivetSingle("GET", "/user/:name", rivetHandlerWrite) diff --git a/routers.go b/routers.go index c94f8fe..be6186b 100644 --- a/routers.go +++ b/routers.go @@ -118,6 +118,14 @@ func aceHandleWrite(c *ace.C) { io.WriteString(c.Writer, c.Param("name")) } +func aceHandleParams(c *ace.C) { + c.Param("a") + c.Param("b") + c.Param("c") + c.Param("d") + c.Param("e") +} + func aceHandleTest(c *ace.C) { io.WriteString(c.Writer, c.Request.RequestURI) } @@ -150,6 +158,16 @@ func aeroHandlerWrite(ctx aero.Context) error { io.WriteString(ctx.Response().Internal(), ctx.Get("name")) return nil } + +func aeroHandlerParams(c aero.Context) error { + c.Get("a") + c.Get("b") + c.Get("c") + c.Get("d") + c.Get("e") + return nil +} + func aeroHandlerTest(ctx aero.Context) error { io.WriteString(ctx.Response().Internal(), ctx.Request().Path()) return nil @@ -205,6 +223,14 @@ func bearHandlerWrite(w http.ResponseWriter, _ *http.Request, ctx *bear.Context) io.WriteString(w, ctx.Params["name"]) } +func bearHandlerParams(w http.ResponseWriter, _ *http.Request, ctx *bear.Context) { + _ = ctx.Params["a"] + _ = ctx.Params["b"] + _ = ctx.Params["c"] + _ = ctx.Params["d"] + _ = ctx.Params["e"] +} + func bearHandlerTest(w http.ResponseWriter, r *http.Request, _ *bear.Context) { io.WriteString(w, r.RequestURI) } @@ -246,6 +272,14 @@ func beegoHandlerWrite(ctx *context.Context) { ctx.WriteString(ctx.Input.Param(":name")) } +func beegoHandlerParams(ctx *context.Context) { + ctx.Input.Param(":a") + ctx.Input.Param(":b") + ctx.Input.Param(":c") + ctx.Input.Param(":d") + ctx.Input.Param(":e") +} + func beegoHandlerTest(ctx *context.Context) { ctx.WriteString(ctx.Request.RequestURI) } @@ -307,6 +341,14 @@ func boneHandlerWrite(rw http.ResponseWriter, req *http.Request) { io.WriteString(rw, bone.GetValue(req, "name")) } +func boneHandlerParams(rw http.ResponseWriter, req *http.Request) { + bone.GetValue(req, "a") + bone.GetValue(req, "b") + bone.GetValue(req, "c") + bone.GetValue(req, "d") + bone.GetValue(req, "e") +} + func loadBone(routes []route) http.Handler { h := http.HandlerFunc(httpHandlerFunc) if loadTestHandler { @@ -352,12 +394,19 @@ func loadBoneSingle(method, path string, handler http.Handler) http.Handler { return router } -// chi // chi func chiHandleWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, chi.URLParam(r, "name")) } +func chiHandleParams(w http.ResponseWriter, r *http.Request) { + chi.URLParam(r, "a") + chi.URLParam(r, "b") + chi.URLParam(r, "c") + chi.URLParam(r, "d") + chi.URLParam(r, "e") +} + func loadChi(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler { @@ -414,6 +463,14 @@ func cloudyKitRouterHandlerWrite(w http.ResponseWriter, _ *http.Request, ps clou io.WriteString(w, ps.ByName("name")) } +func cloudyKitRouterHandlerParams(_ http.ResponseWriter, _ *http.Request, ps cloudykitrouter.Parameter) { + ps.ByName("a") + ps.ByName("b") + ps.ByName("c") + ps.ByName("d") + ps.ByName("e") +} + func cloudyKitRouterHandlerTest(w http.ResponseWriter, r *http.Request, _ cloudykitrouter.Parameter) { io.WriteString(w, r.RequestURI) } @@ -444,6 +501,14 @@ func dencoHandlerWrite(w http.ResponseWriter, r *http.Request, params denco.Para io.WriteString(w, params.Get("name")) } +func dencoHandlerParams(w http.ResponseWriter, r *http.Request, params denco.Params) { + params.Get("a") + params.Get("b") + params.Get("c") + params.Get("d") + params.Get("e") +} + func dencoHandlerTest(w http.ResponseWriter, r *http.Request, params denco.Params) { io.WriteString(w, r.RequestURI) } @@ -486,6 +551,15 @@ func echoHandlerWrite(c echo.Context) error { return nil } +func echoHandlerParams(c echo.Context) error { + c.Param("a") + c.Param("b") + c.Param("c") + c.Param("d") + c.Param("e") + return nil +} + func echoHandlerTest(c echo.Context) error { io.WriteString(c.Response(), c.Request().RequestURI) return nil @@ -540,7 +614,15 @@ func loadEchoSingle(method, path string, h echo.HandlerFunc) http.Handler { func ginHandle(_ *gin.Context) {} func ginHandleWrite(c *gin.Context) { - io.WriteString(c.Writer, c.Params.ByName("name")) + io.WriteString(c.Writer, c.Param("name")) +} + +func ginHandleParams(c *gin.Context) { + c.Param("a") + c.Param("b") + c.Param("c") + c.Param("d") + c.Param("e") } func ginHandleTest(c *gin.Context) { @@ -579,6 +661,14 @@ func gocraftWebHandlerWrite(w web.ResponseWriter, r *web.Request) { io.WriteString(w, r.PathParams["name"]) } +func gocraftWebHandlerParams(w web.ResponseWriter, r *web.Request) { + _ = r.PathParams["a"] + _ = r.PathParams["b"] + _ = r.PathParams["c"] + _ = r.PathParams["d"] + _ = r.PathParams["e"] +} + func gocraftWebHandlerTest(w web.ResponseWriter, r *web.Request) { io.WriteString(w, r.RequestURI) } @@ -629,10 +719,20 @@ func loadGocraftWebSingle(method, path string, handler interface{}) http.Handler } // goji -func gojiFuncWrite(c goji.C, w http.ResponseWriter, r *http.Request) { +func gojiHandler(c goji.C, w http.ResponseWriter, r *http.Request) {} + +func gojiHandlerWrite(c goji.C, w http.ResponseWriter, r *http.Request) { io.WriteString(w, c.URLParams["name"]) } +func gojiHandlerParams(c goji.C, w http.ResponseWriter, r *http.Request) { + _ = c.URLParams["a"] + _ = c.URLParams["b"] + _ = c.URLParams["c"] + _ = c.URLParams["d"] + _ = c.URLParams["e"] +} + func loadGoji(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler { @@ -685,6 +785,14 @@ func gojiv2HandlerWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, gojiv2pat.Param(r, "name")) } +func gojiv2HandlerParams(w http.ResponseWriter, r *http.Request) { + gojiv2pat.Param(r, "a") + gojiv2pat.Param(r, "b") + gojiv2pat.Param(r, "c") + gojiv2pat.Param(r, "d") + gojiv2pat.Param(r, "e") +} + func gojiv2HandlerTest(w http.ResponseWriter, r *http.Request) { io.WriteString(w, r.RequestURI) } @@ -741,6 +849,14 @@ func goJsonRestHandlerWrite(w rest.ResponseWriter, req *rest.Request) { io.WriteString(w.(io.Writer), req.PathParam("name")) } +func goJsonRestHandlerParams(w rest.ResponseWriter, req *rest.Request) { + req.PathParam("a") + req.PathParam("b") + req.PathParam("c") + req.PathParam("d") + req.PathParam("e") +} + func goJsonRestHandlerTest(w rest.ResponseWriter, req *rest.Request) { io.WriteString(w.(io.Writer), req.RequestURI) } @@ -785,6 +901,14 @@ func goRestfulHandlerWrite(r *restful.Request, w *restful.Response) { io.WriteString(w, r.PathParameter("name")) } +func goRestfulHandlerParams(r *restful.Request, w *restful.Response) { + r.PathParameter("a") + r.PathParameter("b") + r.PathParameter("c") + r.PathParameter("d") + r.PathParameter("e") +} + func goRestfulHandlerTest(r *restful.Request, w *restful.Response) { io.WriteString(w, r.Request.RequestURI) } @@ -849,6 +973,15 @@ func gorillaHandlerWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, params["name"]) } +func gorillaHandlerParams(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + _ = params["a"] + _ = params["b"] + _ = params["c"] + _ = params["d"] + _ = params["e"] +} + func loadGorillaMux(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler { @@ -877,6 +1010,14 @@ func gowwwRouterHandleWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, gowwwrouter.Parameter(r, "name")) } +func gowwwRouterHandleParams(w http.ResponseWriter, r *http.Request) { + gowwwrouter.Parameter(r, "a") + gowwwrouter.Parameter(r, "b") + gowwwrouter.Parameter(r, "c") + gowwwrouter.Parameter(r, "d") + gowwwrouter.Parameter(r, "e") +} + func loadGowwwRouter(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler { @@ -903,6 +1044,14 @@ func httpRouterHandleWrite(w http.ResponseWriter, _ *http.Request, ps httprouter io.WriteString(w, ps.ByName("name")) } +func httpRouterHandleParams(w http.ResponseWriter, _ *http.Request, ps httprouter.Params) { + ps.ByName("a") + ps.ByName("b") + ps.ByName("c") + ps.ByName("d") + ps.ByName("e") +} + func httpRouterHandleTest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { io.WriteString(w, r.RequestURI) } @@ -933,6 +1082,14 @@ func httpTreeMuxHandlerWrite(w http.ResponseWriter, _ *http.Request, vars map[st io.WriteString(w, vars["name"]) } +func httpTreeMuxHandlerParams(w http.ResponseWriter, _ *http.Request, vars map[string]string) { + _ = vars["a"] + _ = vars["b"] + _ = vars["c"] + _ = vars["d"] + _ = vars["e"] +} + func httpTreeMuxHandlerTest(w http.ResponseWriter, r *http.Request, _ map[string]string) { io.WriteString(w, r.RequestURI) } @@ -973,6 +1130,7 @@ func (h *kochaHandler) Post(w http.ResponseWriter, r *http.Request) {} func (h *kochaHandler) Put(w http.ResponseWriter, r *http.Request) {} func (h *kochaHandler) Patch(w http.ResponseWriter, r *http.Request) {} func (h *kochaHandler) Delete(w http.ResponseWriter, r *http.Request) {} + func (h *kochaHandler) kochaHandlerWrite(w http.ResponseWriter, r *http.Request) { var name string for _, param := range h.params { @@ -1039,13 +1197,20 @@ func loadKochaSingle(method, path string, handler *kochaHandler, hfunc http.Hand } // LARS -func larsHandler(c lars.Context) { -} +func larsHandler(c lars.Context) {} func larsHandlerWrite(c lars.Context) { io.WriteString(c.Response(), c.Param("name")) } +func larsHandlerParams(c lars.Context) { + c.Param("a") + c.Param("b") + c.Param("c") + c.Param("d") + c.Param("e") +} + func larsHandlerTest(c lars.Context) { io.WriteString(c.Response(), c.Request().RequestURI) } @@ -1108,6 +1273,15 @@ func macaronHandlerWrite(c *macaron.Context) string { return c.Params("name") } +func macaronHandlerParams(c *macaron.Context) string { + c.Params("a") + c.Params("b") + c.Params("c") + c.Params("d") + c.Params("e") + return "" +} + func macaronHandlerTest(c *macaron.Context) string { return c.Req.RequestURI } @@ -1138,6 +1312,15 @@ func martiniHandlerWrite(params martini.Params) string { return params["name"] } +func martiniHandlerParams(params martini.Params) string { + _ = params["a"] + _ = params["b"] + _ = params["c"] + _ = params["d"] + _ = params["e"] + return "" +} + func initMartini() { martini.Env = martini.Prod } @@ -1197,6 +1380,15 @@ func patHandlerWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, r.URL.Query().Get(":name")) } +func patHandlerParams(w http.ResponseWriter, r *http.Request) { + q := r.URL.Query() + q.Get(":a") + q.Get(":b") + q.Get(":c") + q.Get(":d") + q.Get(":e") +} + func loadPat(routes []route) http.Handler { h := http.HandlerFunc(httpHandlerFunc) if loadTestHandler { @@ -1248,6 +1440,16 @@ func possumHandlerWrite(c *possum.Context) error { return nil } +func possumHandlerParams(c *possum.Context) error { + q := c.Request.URL.Query() + q.Get(":a") + q.Get(":b") + q.Get(":c") + q.Get(":d") + q.Get(":e") + return nil +} + func possumHandlerTest(c *possum.Context) error { io.WriteString(c.Response, c.Request.RequestURI) return nil @@ -1279,6 +1481,14 @@ func r2routerHandleWrite(w http.ResponseWriter, req *http.Request, params r2rout io.WriteString(w, params.Get("name")) } +func r2routerHandleParams(w http.ResponseWriter, req *http.Request, params r2router.Params) { + params.Get("a") + params.Get("b") + params.Get("c") + params.Get("d") + params.Get("e") +} + func r2routerHandleTest(w http.ResponseWriter, req *http.Request, _ r2router.Params) { io.WriteString(w, req.RequestURI) } @@ -1430,6 +1640,14 @@ func rivetHandlerWrite(c *rivet.Context) { c.WriteString(c.Get("name")) } +func rivetHandlerParams(c *rivet.Context) { + c.Get("a") + c.Get("b") + c.Get("c") + c.Get("d") + c.Get("e") +} + func rivetHandlerTest(c *rivet.Context) { c.WriteString(c.Req.RequestURI) } @@ -1462,6 +1680,15 @@ func tangoHandlerWrite(ctx *tango.Context) { ctx.Write([]byte(ctx.Params().Get(":name"))) } +func tangoHandlerParams(ctx *tango.Context) { + p := ctx.Params() + p.Get(":a") + p.Get(":b") + p.Get(":c") + p.Get(":d") + p.Get(":e") +} + func tangoHandlerTest(ctx *tango.Context) { ctx.Write([]byte(ctx.Req().RequestURI)) } @@ -1495,6 +1722,15 @@ func tigerTonicHandlerWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, r.URL.Query().Get("name")) } +func tigerTonicHandlerParams(w http.ResponseWriter, r *http.Request) { + q := r.URL.Query() + q.Get("a") + q.Get("b") + q.Get("c") + q.Get("d") + q.Get("e") +} + func loadTigerTonic(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler { @@ -1522,6 +1758,15 @@ func trafficHandlerWrite(w traffic.ResponseWriter, r *traffic.Request) { io.WriteString(w, r.URL.Query().Get("name")) } +func trafficHandlerParams(w traffic.ResponseWriter, r *traffic.Request) { + q := r.URL.Query() + q.Get("a") + q.Get("b") + q.Get("c") + q.Get("d") + q.Get("e") +} + func trafficHandlerTest(w traffic.ResponseWriter, r *traffic.Request) { io.WriteString(w, r.RequestURI) } @@ -1582,6 +1827,15 @@ func vulcanHandlerWrite(w http.ResponseWriter, r *http.Request) { io.WriteString(w, r.URL.Query().Get("name")) } +func vulcanHandlerParams(w http.ResponseWriter, r *http.Request) { + q := r.URL.Query() + q.Get("a") + q.Get("b") + q.Get("c") + q.Get("d") + q.Get("e") +} + func loadVulcan(routes []route) http.Handler { h := httpHandlerFunc if loadTestHandler {