davsclaus opened a new pull request, #24604: URL: https://github.com/apache/camel/pull/24604
## Backport of #24597 _Claude Code on behalf of davsclaus_ Cherry-pick of #24597 onto `camel-4.18.x`. **Original PR:** #24597 - CAMEL-24001: Fix RestBindingAdvice setting Content-Type on body-less responses **Original author:** @davsclaus **Target branch:** `camel-4.18.x` ### Original description Fixes two bugs in `RestBindingAdvice.marshal()` related to Content-Type handling: **Bug 1 - Content-Type set on body-less responses:** `ensureHeaderContentType()` was called before the null-body check, so responses with no body (e.g. 204 No Content) got a spurious Content-Type header. Moved the null-body check to before the `ensureHeaderContentType()` call. **Bug 2 - Multi-value `produces` used as Content-Type:** `ensureHeaderContentType()` set the raw comma-separated `produces` string (e.g. `application/json,text/plain`) as Content-Type before the `isJson`/`isXml` fallback branches had a chance to set a proper single media type. Reordered the priority so `isJson`/`isXml` are checked first (setting `application/json` or `application/xml`), with the raw `produces` string only used as a last resort. 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]
