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

   Fixes [CAMEL-25046](https://issues.apache.org/jira/browse/CAMEL-25046): bugs 
in the rest DSL found in a deep review. Each fix has a test that fails without 
it (`RestDslEdgeCasesTest`, `RestUtilTest`, `RestBindingAdviceEmptyXmlTest`).
   
   1. **`responseMessage(int code, String message)` drops the response 
message.** It was created but never added to the verb (the `String` variant 
does add it), so it was missing from the api docs and response validation.
   2. **An `Accept` header with parameters gives a false 406 with 
`clientRequestValidation`.** `RestUtil.isValidOrAcceptedContentType` cut the 
whole header at the first `;` before splitting on commas, so 
`application/xml;q=0.9, application/json` was read as `application/xml`. The 
parameters are now removed from each media type, and an empty part (trailing 
comma) no longer matches.
   3. **consumes/produces are not inferred from the binding mode of the rest 
configuration.** With `type`/`outType` and binding mode json/xml, they were 
only inferred when the binding mode was set on the rest or verb, not on 
`restConfiguration()`. The contract-first path already used the configuration.
   4. **An inlined route overwrites the stream caching of the rest verb.** The 
verb's `streamCache` was replaced by the inlined `direct` route's value 
(usually null). It is now only copied when the direct route sets it, as the 
route id already is.
   5. **`rest().bindingMode("{{mode}}")` lower-cases the placeholder**, so a 
key with upper-case letters was not found.
   6. **`enableNoContentResponse` does not detect `<el></el>` without an xml 
declaration** (off by one). The check is now a small helper with a unit test.
   
   **Not changed (for a later look)**
   - `clientResponseValidation` only runs after marshalling, so it is skipped 
with binding mode off, a null body or `skipBindingOnErrorCode`.
   - The response headers of all response messages are required on every 
response, whatever its code.
   - A duplicate verb id is silently replaced by a generated id, and the same 
`direct` route inlined by two rest definitions is not detected.
   - `type(...)` adds the body parameter after the binding is created, so 
`requiredBody` is not enforced.
   
   3 changes behaviour and is in the 4.23 upgrade guide. The whole `camel-core` 
test suite passes.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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