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

   ## Backport of #26024
   
   Cherry-pick of #26024 onto `camel-4.22.x`.
   
   **Original PR:** #26024 - CAMEL-24409: keep binary bodies intact in rest 
client request validation
   **Original author:** @chala2001
   **Target branch:** `camel-4.22.x`
   
   ### Summary
   
   With `clientRequestValidation` enabled and a REST service that declares a 
required body, binary payloads (e.g. `application/octet-stream`) were 
corrupted: `DefaultRestClientRequestValidator` read the body as a `String` and 
wrote it back, replacing bytes that are not valid UTF-8 with `EF BF BD` (the 
Unicode replacement character). `MessageHelper.extractBodyAsString` already 
leaves the body as a re-readable `StreamCache`, so the write-back was 
unnecessary. Removing it keeps the required-body check while leaving the 
payload untouched.
   
   ### Backport notes
   
   - Java fix (`DefaultRestClientRequestValidator`) and the 
`RestJettyRequiredBodyTest` cherry-picked cleanly.
   - The upgrade-guide note was relocated from 
`camel-4x-upgrade-guide-4_23.adoc` (does not exist on this line) to 
`camel-4x-upgrade-guide-4_22.adoc`, matching the release line this fix ships in.
   - Verified: `camel-support` builds and `RestJettyRequiredBodyTest` passes 
(4/4).
   
   _Claude Code on behalf of davsclaus_


-- 
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