Skip to content

Commit

Permalink
[httpclent][har] ensure gzipped responses are encoded in base64 to be…
Browse files Browse the repository at this point in the history
… readable in json
  • Loading branch information
rmannibucau committed Jan 12, 2024
1 parent 70afd1a commit 991bfb2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ private Body extractBody(final HttpResponse<?> response, final byte[] body) {
.map(contentType -> new Body(
body.length,
List.of("application/octet-stream", "multipart/form-data").contains(contentType) ||
contentType.startsWith("application/vnd.openxmlformats-officedocument") ?
contentType.startsWith("application/vnd.openxmlformats-officedocument") ||
response.headers().firstValue("content-encoding").isPresent() ?
new Har.Content(body.length, 0, contentType, Base64.getEncoder().encodeToString(body), "base64", "") :
new Har.Content(body.length, 0, contentType, new String(body, StandardCharsets.UTF_8), null, "")))
.orElseGet(() -> new Body(body.length, null));
Expand Down

0 comments on commit 991bfb2

Please sign in to comment.