[backport camel-4.22.x] CAMEL-25085: camel-support - RestBindingAdvice takes the response Content-Type from produces - #27287
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>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet-bot
left a comment
There was a problem hiding this comment.
Clean cherry-pick of #26986 (main, merged by @davsclaus). Java code and tests are byte-identical to the parent PR — already reviewed and approved by @oscerd and @gnodet-bot.
The upgrade guide is correctly adapted: the note is placed under "Upgrading from 4.22.1 to 4.22.2" in camel-4x-upgrade-guide-4_22.adoc, and the 4_18 / 4_23 guide edits from main are correctly excluded.
Milestone: should be set to 4.22.2.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 556 tested, 28 compile-only — current: 555 all testedMaveniverse Scalpel detected 584 affected modules (current approach: 555).
|
Backport of #26986 (CAMEL-25085) to
camel-4.22.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.22.0 (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.Straight cherry-pick of 4767770. The code hunk and both tests applied without conflicts. Only the upgrade guides conflicted: this PR keeps the note in
camel-4x-upgrade-guide-4_22.adocunder a new "Upgrading from 4.22.1 to 4.22.2" section and drops the 4_18 and 4_23 guide edits, which belong onmain.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