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

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27669
   
   ## What was wrong
   
   `RestComponent.createEndpoint()` sends the parameters of a `rest:` endpoint 
uri that the endpoint does not know as query parameters, and leaves out the 
options of the producer component. It left them out only when 
`producerComponentName` was set on the endpoint or on the `rest` component. 
When the producer component came from the rest configuration 
(`restConfiguration().producerComponent("http")`) or was auto-detected by 
`RestEndpoint.createProducer()`, an option such as `authPassword` of camel-http 
was applied to the http endpoint **and** also sent in the query string of the 
request URL:
   
   ```
   GET 
/api/items?authMethod=Basic&authPassword=secret&authUsername=ann&authenticationPreemptive=true&page=2
   ```
   
   ## What changed
   
   - `RestComponent.createEndpoint()` uses the `producerComponent` of the rest 
configuration when `producerComponentName` is not set (the same order as the 
producer lookup), and hands the unknown parameters to the endpoint.
   - `RestEndpoint` keeps those parameters apart from the `queryParameters` 
option, and `createProducer()` leaves out the options of the producer component 
it found (also an auto-detected one) before creating the producer.
   - Parameters that the producer component does not know stay query 
parameters, and the `queryParameters` option still takes precedence, as before.
   - The `EndpointUriFactory` lookup moved from `RestComponent` to 
`RestEndpoint`.
   
   ## Tests
   
   - `RestProducerComponentOptionsTest` (camel-rest, 5 tests): a dummy 
`RestProducerFactory` component with a dummy `EndpointUriFactory`, for 
`producerComponentName`, rest configuration, auto-detection, only producer 
options, and an explicit `queryParameters` that keeps a parameter of the same 
name. Before the fix 4 of them fail (the `producerComponentName` case passes).
   - `HttpRestProducerQueryParametersTest` (camel-http, 3 tests): end to end 
with a JDK `HttpServer` on port 0, checks the raw query string the server 
receives (`page=2`) and that the Basic login is applied. Before the fix the 
rest configuration and auto-detected cases fail.
   - All camel-rest tests pass.
   
   ## Docs
   
   - `rest-component.adoc` (and the catalog copy): a paragraph and example on 
which uri parameters become query parameters.
   - `queryParameters` option description updated (component JSON, catalog 
JSON, endpoint DSL regenerated).
   - Upgrade guide 4.24: `camel-rest - the options of the producer component 
are not sent as query parameters`.
   
   _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