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

GrpcClient.Builder's baseUrl path segments get ignored #2730

Open
MariusVolkhart opened this issue Dec 1, 2023 · 3 comments
Open

GrpcClient.Builder's baseUrl path segments get ignored #2730

MariusVolkhart opened this issue Dec 1, 2023 · 3 comments

Comments

@MariusVolkhart
Copy link
Contributor

When using the compiler to generate a Kotlin client, the GrpcMethod.paths that are generated are absolute. For example /greeter.HelloService/SayHello. The GrpcClient.Builder takes a baseUrl, but since the paths are absolute, and path segments of the baseUrl are discarded when GrpcClient#newCall runs.

If the paths were relative, greeter.HelloService/SayHello (no leading slash), then the baseUrl containing path segments would work fine.

My use case is that I'm adding gRPC to an existing application, and am being asked to deploy it at a path like /appName/grpc/*.

My workaround is an OkHttp interceptor that rewrites the request URL to include the path components I need.

@MariusVolkhart
Copy link
Contributor Author

I can make a PR with whatever changes, if any, are desired.

@oldergod
Copy link
Member

Thanks for reporting. PR welcome !

@swankjesse
Copy link
Member

Is this layering with a path prefix something gRPC does elsewhere? I’m unfamiliar with it!

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

3 participants