Not able to call custom middleware handler over a group


#1

Hi, I am not able to use my custom middleware handler when I am adding it to a group. While same works fine when I am associating it with echo context. I am using echo 4.0.0

 //DoingSomething is http handler 
func DoingSomething(e echo.Context) error {
	return e.JSON(http.StatusOK, "Did it")
}
//Auth middleware
func Auth(next echo.HandlerFunc) echo.HandlerFunc {
	return func(c echo.Context) error {
		appID := c.FormValue("appId")
		accessKey := c.FormValue("secretKey")
		fmt.Println("id,key", appID, accessKey)
		if appID == "id" && accessKey == "key" {
			fmt.Println("authenticated from middleware")
			return next(c)
		}
		return c.JSON(http.StatusBadRequest, "bad request")
	}
}

func main() {

	e := echo.New()
	e.POST("/api/dosomething", DoingSomething)
	g := e.Group("/api/")
	g.Use(Auth)     //doesn't work
	//e.Use(Auth)   //<--this works but it can't restrict over a particular group.
	e.Logger.Fatal(e.Start(":7777"))
}