Skip to content

Commit edf2f25

Browse files
刘斌刘斌
authored andcommitted
返回值json 、reqId 判断
1 parent 32374d9 commit edf2f25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/qiniu/http/Response.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ private Response(com.squareup.okhttp.Response response, int statusCode, String r
6666
static Response create(com.squareup.okhttp.Response response, String address, double duration) {
6767
String error = null;
6868
int code = response.code();
69-
String reqId = "";
69+
String reqId = null;
7070

7171
byte[] body = null;
7272
if (ctype(response).equals(Client.JsonMime)) {
7373
reqId = response.header("X-Reqid");
74-
reqId = (reqId == null) ? "" : reqId.trim();
74+
reqId = (reqId == null) ? null : reqId.trim();
7575
try {
7676
body = response.body().bytes();
7777
if (response.code() >= 400 && !StringUtils.isNullOrEmpty(reqId) && body != null) {
@@ -114,7 +114,7 @@ private static String ctype(com.squareup.okhttp.Response response) {
114114
}
115115

116116
public boolean isOK() {
117-
return statusCode == 200 && error == null && reqId.length() > 0;
117+
return statusCode == 200 && error == null && reqId != null && reqId.length() > 0;
118118
}
119119

120120
public boolean isNetworkBroken() {

0 commit comments

Comments
 (0)