Skip to content

Commit

Permalink
对于未知类型数据,小于1M才去读取body并打印
Browse files Browse the repository at this point in the history
  • Loading branch information
liujingxing committed Aug 20, 2024
1 parent 9db704b commit f946e4b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions rxhttp/src/main/java/rxhttp/wrapper/utils/LogUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,9 @@ private static boolean printBody(@NotNull ResponseBody responseBody) {
if (type.equalsIgnoreCase("image") || type.equalsIgnoreCase("audio")
|| type.equalsIgnoreCase("video") || subtype.equalsIgnoreCase("zip"))
return false;

if (mediaType.charset() != null)
return true;
}
//Considering that the contentType may be misused, try to print if the contentLength is less than 1M
return responseBody.contentLength() < 1024 * 1024;
return mediaType != null && mediaType.charset() != null && responseBody.contentLength() < 1024 * 1024;
}

/**
Expand Down

0 comments on commit f946e4b

Please sign in to comment.