Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with negative request/response sizes displayed. #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ internal class HttpTransaction(
}

private fun formatBytes(bytes: Long): String {
return FormatUtils.formatByteCount(bytes, true)
return FormatUtils.formatByteCount(bytes.coerceAtLeast(0), true)
}

fun getFormattedRequestBody(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ internal class HttpTransactionTuple(

val totalSizeString: String
get() {
val reqBytes = requestContentLength ?: 0
val resBytes = responseContentLength ?: 0
val reqBytes = requestContentLength?.coerceAtLeast(0) ?: 0
val resBytes = responseContentLength?.coerceAtLeast(0) ?: 0
return formatBytes(reqBytes + resBytes)
}

Expand Down