Group routes does not work without leading slash
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start by reproducing the grouped-route example in the issue and trace Echo's group route registration and matching behavior. Add regression coverage for both g.GET("posts", handler) and g.GET("/posts", handler) under /v1; done means requests to /v1/posts resolve in both cases, or the documented warning behavior is covered.
Written by the indexing model from the issue text.
Description
Group route does not work without leading slash
I ran into an unexpected behavior with grouped routes.
g := e.Group("/v1")
g.GET("posts", handler)
Requesting:
GET /v1/posts
returns:
Not Found
Changing it to:
g.GET("/posts", handler)
works as expected.
I would expect Echo to handle the missing leading / when combining the group prefix and route path, or at least provide a warning during route registration.
It would be nice if both forms resulted in /v1/posts:
g.GET("posts", handler)
g.GET("/posts", handler)
Because it is very normal for a developer to not provide the slash since a group already means it's under that group (so slash should come automatically)
Otherwise its too confusing and something to forget easily when using the framework!!
- Dominant language
- Go
- Stars
- 32.7k
- Forks
- 2.8k
- Avg merge
- 9h 39m
- Merged PRs (30d)
- 6
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from labstack/echo
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·