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

Why does this route work for one endpoint but not another? #1148

Closed
lansana opened this issue Oct 27, 2017 · 1 comment · Fixed by #2663
Closed

Why does this route work for one endpoint but not another? #1148

lansana opened this issue Oct 27, 2017 · 1 comment · Fixed by #2663

Comments

@lansana
Copy link

lansana commented Oct 27, 2017

When I start my router, I get this error:

...
[GIN-debug] GET    /v1/taxes/:taxId          --> microservices/wwwapi/controller.(*TaxController).FindByID-fm (7 handlers)
[GIN-debug] PUT    /v1/taxes/:taxId          --> microservices/wwwapi/controller.(*TaxController).UpdateByID-fm (7 handlers)
[GIN-debug] DELETE /v1/taxes/:taxId          --> microservices/wwwapi/controller.(*TaxController).SoftDeleteByID-fm (7 handlers)
[GIN-debug] GET    /v1/users/username/:userId --> microservices/wwwapi/controller.(*UserController).FindByUsername-fm (7 handlers)
[GIN-debug] GET    /v1/users/:userId         --> microservices/wwwapi/controller.(*UserController).FindByID-fm (7 handlers)
panic: wildcard route ':userId' conflicts with existing children in path '/v1/users/:userId'
...

But the error makes no sense because if you look at the taxes endpoint, it has a GET, PUT, and DELETE all on the same /v1/taxes/:taxId endpoint, but when I try it for the users endpoint it gives me that error.

Why is this happening? Makes no sense... you'd think it would give me the same error for both endpoints.

@lansana lansana closed this as completed Oct 27, 2017
@lansana lansana reopened this Oct 27, 2017
@lansana
Copy link
Author

lansana commented Oct 27, 2017

Never mind, figured it out. Apparently I can't have a path like /users/foo in combination with /users/:id, and have to use something like /users/:id/foo instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant