Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

short-circuit and return no matching route for empty param values #224

Merged
merged 1 commit into from
Jul 8, 2017

Conversation

pkieltyka
Copy link
Member

No description provided.

@pkieltyka
Copy link
Member Author

hey @dvic - thanks for the PR on #218. I reviewed it and realized another bug was looming that caused the panic. Because, there should never be a case where a parameter key is present in URLParams, but a matching param value wouldn't be available, so I knew something was wrong there.

I debugged it and found and decided that the router should return a 404 instead of matching the handler with an empty param value, because in the case, it does not correctly match the regexp \d+ pattern and even if it was just a normal param, it still doesnt make sense to match it.

chi/mux_test.go

Line 1290 in 7eca4e6

if _, body := testRequest(t, ts, "GET", "/user/", nil); body != "nothing here" {

@pkieltyka pkieltyka merged commit 3a7936b into master Jul 8, 2017
@pkieltyka pkieltyka deleted the fix-218 branch July 8, 2017 18:37
@dvic
Copy link

dvic commented Jul 9, 2017

Nice catch!

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.

2 participants