Retrofit 2 请求的动态 Cookie
我已经使用 Retrofit 很长时间了,之前从未遇到过任何严重的可用性问题。所以我的用例非常简单,我必须从我们用来处理一些数据的另一个 API 中获取实体。现在唯一的问题是服务正在使用 Cookies 来接受实体 ID。
因此,这意味着每个请求都需要有与其关联的动态 cookie 集。但目前我在 Retrofit 中看不到任何这样的东西。我可以看到一个旧的 PR,但由于未知原因被拒绝。
Retrofit 团队的任何人都可以在这件事上提供帮助吗?我认为这会很有帮助。如果您需要代码示例,我可以在编辑中提供。
TIA
I've been using retrofit for quite a long time and haven't faced any serious usability issue before now. So my use case is very simple, I've to fetch an entity from another API that we're using to process a few data. Now the only issue is the service is using Cookies
to accept entity id.
So this means that each request needs to have dynamic set of cookie associated with it. But currently I cannot see anything such that in Retrofit. I can see a old PR, but it was rejected for unknown reason.
Can anyone from Retrofit team can help in this matter. I think it will be very helpful. If you need code examples I can provide that in an edit.
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实现自定义 CookieJar 并在 OkHttpClient 上设置
https:// /square.github.io/okhttp/4.x/okhttp/okhttp3/-cookie-jar/
Implement a custom CookieJar and set on the OkHttpClient
https://square.github.io/okhttp/4.x/okhttp/okhttp3/-cookie-jar/