[backport camel-4.18.x] CAMEL-25085: camel-support - RestBindingAdvice takes the response Content-Type from produces - #27288
Merged
Croway merged 1 commit intoOct 2, 2026
Conversation
…tent-Type from produces (apache#26986) Under json or xml binding, a response without a Content-Type header again takes it from the produces of the rest verb, as before Camel 4.18.4 and 4.22.0 (CAMEL-24001). Those releases used application/json (or xml) whenever the binding mode allowed it and marshalled the body, so a verb producing text/plain answered with a json-quoted body and a binary body failed. When produces lists several media types, the first json (or xml) type is used, otherwise the first one. Wildcards such as */* are skipped. (cherry picked from commit 4767770) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
davsclaus
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #26986 (CAMEL-25085) to
camel-4.18.x.https://issues.apache.org/jira/browse/CAMEL-25085
Under json or xml binding, a response without a Content-Type header again takes it from the
producesof the rest verb, as before 4.18.4 (CAMEL-24001). A verb thatproduces("application/octet-stream")underbindingMode(json)no longer answers an empty 500, and atext/plainverb called with a json Accept header answers plain text again.Cherry-pick of 4767770. The code hunk and the camel-core test applied without conflicts. Two adaptations compared to the original PR:
VertxPlatformHttpRestBindingProducesTestcallscontext.start()instead ofVertxPlatformHttpEngineTest.startCamelContext(context), because that helper does not exist on 4.18.x (the 4.18.xcreateCamelContext()already sets the RestAssured port). Test-only, one line.camel-4x-upgrade-guide-4_18.adocunder the existing "Upgrading from 4.18.4 to 4.18.5" section; the 4_22 and 4_23 guide edits are dropped as those files do not exist on this branch.Verified locally on this branch:
FromRestBindingProducesContentTypeTestfails 2 of 5 without the fix (octet-stream and text/plain getapplication/json) and passes with it;VertxPlatformHttpRestBindingProducesTestpasses.Claude Code on behalf of Croway
🤖 Generated with Claude Code