使用电线时的GRPC URL结肠
我正在尝试致电GRPC语法URL:https://photoslibrary.googleapis.com/v1/mediaitems:search
通过使用电线框架。
第一个问题是将/v1
放在路径中,如下所示,配置忽略了它:
GrpcClient.Builder()
.client(okHttpClient)
.baseUrl("https://photoslibrary.googleapis.com/v1")
.build()
这样的配置呼叫https://photoslibrary.googleapis.com
第二个问题是URL中的结肠。这是我的原始配置:
service MediaItems {
rpc Search(SearchMediaItemCommand) returns (stream SearchMediaItemUpdate) {}
}
这样,我最终会呼叫url:https://photoslibrary.googleapis.com/mediaitems/search
- 如何将V1添加到基础URL? (我可以通过在OkhttpClient中添加拦截器来做到这一点,但感觉不正确)
- 如何为Colon(:)在URL中配置协议?
I'm trying to make a call to grpc syntax URL: https://photoslibrary.googleapis.com/v1/mediaItems:search
by using Wire framework.
First problem is putting /v1
in path as below configuration ignores it:
GrpcClient.Builder()
.client(okHttpClient)
.baseUrl("https://photoslibrary.googleapis.com/v1")
.build()
Such config make calls to https://photoslibrary.googleapis.com
Second problem is colon in the URL. Here is my proto config:
service MediaItems {
rpc Search(SearchMediaItemCommand) returns (stream SearchMediaItemUpdate) {}
}
With this I end up with call to URL: https://photoslibrary.googleapis.com/MediaItems/Search
- How to add v1 to the base URL? (I can do this by adding interceptor in okhttpclient but it doesn't feel right)
- How to config protocol for colon (:) in URL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论