Skip to content

group: join prefix and path with a slash - #3109

Open
team-humaki wants to merge 1 commit into
labstack:masterfrom
team-humaki:group-join-missing-slash
Open

team-humaki wants to merge 1 commit into
labstack:masterfrom
team-humaki:group-join-missing-slash

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #3099.

Group.WithPrefix concatenated the group prefix and route path with no separator, so e.Group("/v1"); g.GET("posts", h) registered /v1posts instead of /v1/posts.

Insert a / when neither side already has one. Paths that start with * stay concatenated so Group.Static("") keeps the documented /prefix* wildcard.

go test . green (TestJoinPathPrefix, TestGroup_pathWithoutLeadingSlash).

Fixes labstack#3099. Group.GET("posts") under "/v1" concatenated to /v1posts.
Insert a slash when neither side has one; keep Static("") /prefix* wildcards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Group routes does not work without leading slash

1 participant