【问题标题】:Android - OkHttp Interceptor call onFailureAndroid - OkHttp拦截器调用onFailure
【发布时间】:2017-07-03 08:34:19
【问题描述】:

有人知道如何从附加到 OkHttp 客户端的 Interceptor 类调用 onFailure 回调吗?

【问题讨论】:

  • 尝试抛出异常。当拦截器抛出异常时,okhttp调用onFailure回调
  • @warnyul 谢谢你是对的。

标签: android interceptor okhttp3


【解决方案1】:

@warnyul 的评论是正确的。一旦我抛出 IOException,它就会触发失败。

【讨论】:

    【解决方案2】:

    尝试抛出异常。当拦截器抛出异常时,okhttp调用onFailure回调

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-16
      • 2015-10-05
      • 2020-09-18
      • 2019-12-28
      • 1970-01-01
      • 2015-06-29
      • 2015-03-23
      • 2021-09-01
      相关资源
      最近更新 更多