Skip to content

Commit 68c7c5b

Browse files
committed
设置上传请求的大小
1 parent f60326d commit 68c7c5b

File tree

1 file changed

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

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ private static ResponseInfo buildResponseInfo(okhttp3.Response response, String
168168

169169
HttpUrl u = response.request().url();
170170
return new ResponseInfo(json, code, reqId, response.header("X-Log"),
171-
via(response), u.host(), u.encodedPath(), ip, u.port(), duration, 0, error);
171+
via(response), u.host(), u.encodedPath(), ip, u.port(), duration, getContentLength(response), error);
172+
}
173+
174+
private static long getContentLength(okhttp3.Response response) {
175+
try {
176+
return response.request().body().contentLength();
177+
} catch (IOException e) {
178+
return -1;
179+
}
172180
}
173181

174182
private static void onRet(okhttp3.Response response, String ip, long duration,

0 commit comments

Comments
 (0)