在 Retrofit 2.0 中,如果第一个请求出现错误代码,则取消所有 api 请求

发布于 2025-01-10 11:20:39 字数 178 浏览 3 评论 0 原文

在后端,如果我阻止用户,用户会在每个响应中收到 417 错误代码,当我的应用程序收到 417 错误代码时,它会显示一个对话框

所以我需要的是,正在运行的 API 列表(如果第一个收到 417 错误代码)其他已处理的API均被取消。

我正在使用 Retrofit 2.0 与 okHttp 和 Interceptor

In the backend, if I block a user the user get a 417 error code in every response and when my app get 417 it shows a dialog

So what I need that, the list of running APIs if the first one gets a 417 error code the other APIs procced are canceled.

I am using Retrofit 2.0 with okHttp and Interceptor

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

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

发布评论

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