【发布时间】:2016-11-06 04:46:42
【问题描述】:
我有以下方法:
Response httpResponse = client.newCall(request).execute();
httpResponse.code();
但在某些情况下(例如,当我断开电话网络、从中国访问 Google 或服务器损坏时),它会给我一个 IOException 而不是错误代码。
如何像 Volley 一样获取所有 HTTP 状态码?
【问题讨论】:
-
在网络断开或服务器完全崩溃的情况下将没有 http-status-code,因为状态码是由服务器发送的。
-
谢谢,我搞错了。
标签: http okhttp http-status-codes