From 8c13b9dae2a0126dafd28126dca5d02e209db902 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Sun, 28 Apr 2019 23:10:00 -0700 Subject: [PATCH] Fixed sub-group virtual hosts --- echo.go | 2 +- group.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/echo.go b/echo.go index 54f6dec0e..d45144d8c 100644 --- a/echo.go +++ b/echo.go @@ -225,7 +225,7 @@ const ( const ( // Version of Echo - Version = "4.1.0" + Version = "4.1.2" website = "https://echo.labstack.com" // http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo banner = ` diff --git a/group.go b/group.go index 50b308a26..a14667e82 100644 --- a/group.go +++ b/group.go @@ -93,11 +93,13 @@ func (g *Group) Match(methods []string, path string, handler HandlerFunc, middle } // Group creates a new sub-group with prefix and optional sub-group-level middleware. -func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) *Group { +func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Group) { m := make([]MiddlewareFunc, 0, len(g.middleware)+len(middleware)) m = append(m, g.middleware...) m = append(m, middleware...) - return g.echo.Group(g.prefix+prefix, m...) + sg = g.echo.Group(g.prefix+prefix, m...) + sg.host = g.host + return } // Static implements `Echo#Static()` for sub-routes within the Group.