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.
When using the compiler to generate a Kotlin client, the
GrpcMethod.path
s that are generated are absolute. For example/greeter.HelloService/SayHello
. TheGrpcClient.Builder
takes abaseUrl
, but since thepath
s are absolute, and path segments of thebaseUrl
are discarded whenGrpcClient#newCall
runs.If the
path
s were relative,greeter.HelloService/SayHello
(no leading slash), then thebaseUrl
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.