Why does Echo allow route params like /users/:id to match /users/3//////? Expected strict behavior #2890
Unanswered
bukandicki
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Echo team 👋
First of all, thank you for the amazing framework. I’m still a Go beginner, so sorry if this is a basic question.
I’m a bit confused about route parameter behavior in Echo.
I have a route like this:
When I access:
✅ This works (expected)
But when I access:
or even:
✅ This also works, and the
idparameter becomes"3//////"(or similar).What I expected
I expected the router to be strict, where:
/users/3→ ✅ allowed/users/3/→ ❌ not allowed/users/3//////→ ❌ not allowedBecause semantically, I thought
:idshould only represent a single clean path segment, not include extra slashes.My questions
/users/3////would not match/users/:id?Context
I understand that Echo tries to be closer to raw HTTP behavior, but from an API design perspective (especially for REST APIs), strict routing feels safer and more predictable.
Again, apologies if this is a beginner misunderstanding — I’d really appreciate some clarification 🙏
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions