Skip to content

Commit 3f10b35

Browse files
committed
get 时 body 为 null,上传 0
1 parent 10dd2bc commit 3f10b35

File tree

1 file changed

+5
-1
lines changed
  • library/src/main/java/com/qiniu/android/http

1 file changed

+5
-1
lines changed

library/src/main/java/com/qiniu/android/http/Client.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ private static ResponseInfo buildResponseInfo(okhttp3.Response response, String
173173

174174
private static long getContentLength(okhttp3.Response response) {
175175
try {
176-
return response.request().body().contentLength();
176+
RequestBody body = response.request().body();
177+
if (body == null) {
178+
return 0;
179+
}
180+
return body.contentLength();
177181
} catch (Throwable t) {
178182
return -1;
179183
}

0 commit comments

Comments
 (0)