使用电线时的GRPC URL结肠

发布于 2025-02-08 15:06:13 字数 843 浏览 1 评论 0原文

我正在尝试致电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

  1. 如何将V1添加到基础URL? (我可以通过在OkhttpClient中添加拦截器来做到这一点,但感觉不正确)
  2. 如何为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

  1. How to add v1 to the base URL? (I can do this by adding interceptor in okhttpclient but it doesn't feel right)
  2. How to config protocol for colon (:) in URL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文