Skip to content

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

@lansana

Description

@lansana

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions