[4.18.x] CAMEL-23936: Fix logHttpActivity losing Content-Encoding on gzip responses#24507
Conversation
…onses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
oscerd
left a comment
There was a problem hiding this comment.
Backport LGTM. The fix is faithfully carried to camel-4.18.x: since ce is a Header on this branch (vs a String on main), the adaptation new ByteArrayEntity(arr, ct, ce != null ? ce.getValue() : null) yields the same effective content-encoding. CI is green.
One minor, non-blocking note: this cherry-picks only the first commit of #24506, so it carries the self-contained version of the test rather than main's second-commit refactor that extends HttpCompressionTest. That is fine (self-contained tests are an accepted pattern here) — just flagging in case you want parity.
Reviewed with Claude Code on behalf of Andrea Cosentino. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
Summary
Claude Code on behalf of davsclaus
Backport of #24506 to
camel-4.18.x.When
logHttpActivityis enabled and the HTTP server returns a gzip-encoded response, the response body is not decompressed, causing downstream processing (e.g., Jackson JSON parsing) to fail withJsonParseException: Illegal character (CTRL-CHAR, code 31).Fix: Pass the original content encoding to the
ByteArrayEntityconstructor when replacing the consumed response entity inLoggingHttpActivityListener.Note: On 4.18.x the
cevariable is aHeader(notStringas onmain), so the fix extractsce.getValue().Test plan
HttpLoggingActivityGzipTest— verifies gzip-encoded responses are correctly decompressed whenlogHttpActivityis enabledcamel-httptests pass🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com