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

Wrong mapping of REST endpoint to rpc handler. #3687

Closed
kamesh-09 opened this issue Oct 23, 2023 · 1 comment
Closed

Wrong mapping of REST endpoint to rpc handler. #3687

kamesh-09 opened this issue Oct 23, 2023 · 1 comment

Comments

@kamesh-09
Copy link

kamesh-09 commented Oct 23, 2023

🐛 Bug Report

I am facing similar issue as mentioned here -
#2254

If there are 2 rest endpoints as given below: suppose both of them are POST:

  1. api/user/{userID}/details
  2. api/user/{userID}/{permission}

then making a rest call to 1st API is getting mapped to 2nd RPC handler which results in wrong response.
This somewhere happens in runtime/mux.go and runtime/pattern.go file.
It matches the details as permission variable.

I am facing this while migrating away from grpc-gateway v1 to v2.
Mentioning specific version of v2 - v2.11.3

Ideally the path should be matched first with fixed path params.

I see that this change was introduced to - Implement last-match-wins behaviour in mux, but that default behaviour break this case.

@johanbrandhorst
Copy link
Collaborator

Yes this is an intentionally breaking change from v1 to v2. The v1 behavior was not correctly following the http.proto spec. The original issue has more information, but this is working as intended.

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

No branches or pull requests

2 participants