Skip to content

Commit

Permalink
Interpret negative/zero body-limit as infinite
Browse files Browse the repository at this point in the history
Currently, if body-limit is set to -1 or zero, there will be either an IOOB exception, or an empty String.

Instead, interpret body-limit <= 0 as 'no limit'.
  • Loading branch information
brunoborges authored Mar 2, 2023
1 parent c288c43 commit c587e2d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public void logRequest(HttpClientRequest request, Buffer body, boolean omitBody)
private String bodyToString(Buffer body) {
if (body == null) {
return "";
} else if (bodySize <= 0) {
return body.toString();
} else {
String bodyAsString = body.toString();
return bodyAsString.substring(0, Math.min(bodySize, bodyAsString.length()));
Expand Down

0 comments on commit c587e2d

Please sign in to comment.