davsclaus opened a new pull request, #24506:
URL: https://github.com/apache/camel/pull/24506

   ## Summary
   
   _Claude Code on behalf of davsclaus_
   
   When `logHttpActivity` is 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 with `JsonParseException: Illegal 
character (CTRL-CHAR, code 31)`.
   
   **Root cause:** In `LoggingHttpActivityListener`, when the response entity's 
stream is consumed for logging and a replacement `ByteArrayEntity` is created, 
the original `Content-Encoding` (e.g., `gzip`) was not passed to the new 
entity. This caused Apache HttpClient's `ContentCompressionExec` to skip 
decompression, leaving the raw gzip bytes in the response body.
   
   **Fix:** Pass the original content encoding as the third argument to the 
`ByteArrayEntity` constructor, preserving the encoding metadata for downstream 
decompression.
   
   - `LoggingHttpActivityListener.java:208` — `new ByteArrayEntity(arr, ct)` → 
`new ByteArrayEntity(arr, ct, ce)`
   
   ## Test plan
   
   - [x] New `HttpLoggingActivityGzipTest` — verifies gzip-encoded responses 
are correctly decompressed when `logHttpActivity` is enabled
   - [x] Verified the test fails without the fix (raw gzip bytes reach the body)
   - [x] All existing `camel-http` tests pass
   
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   Co-Authored-By: Claude Opus 4.6 <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to