Claus Ibsen created CAMEL-27669:
-----------------------------------
Summary: camel-rest - producer component options on the rest URI
are sent as query parameters when the producer component comes from the rest
configuration
Key: CAMEL-27669
URL: https://issues.apache.org/jira/browse/CAMEL-27669
Project: Camel
Issue Type: Bug
Components: rest
Reporter: Claus Ibsen
Fix For: 4.24.0
{{RestComponent.createEndpoint()}} moves the parameters of a {{rest:}} endpoint
uri that are not rest options into the {{queryParameters}} of the endpoint. It
removes the options of the producer component (such as {{authUsername}} and
{{authPassword}} of camel-http) from them, but only when
{{producerComponentName}} is set on the endpoint or on the rest component.
When the producer component comes from the rest configuration
({{restConfiguration().producerComponent("http")}}) or is auto-detected by
{{RestEndpoint.createProducer()}} (an existing or default component that is a
{{RestProducerFactory}}), nothing is removed. The option is then applied to the
producer endpoint and is also sent to the server as a query parameter in the
request url, for example:
{code}
restConfiguration().producerComponent("http").host("localhost:8080");
from("direct:start").to("rest:get:users?authUsername=scott&authPassword=tiger");
{code}
calls {{http://localhost:8080/users?authPassword=tiger&authUsername=scott}}.
Proposed change: remove the options known by the producer component from the
query parameters once the producer component is known, in
{{RestEndpoint.createProducer()}}, with the same lookup as the producer
(endpoint or component option, rest configuration, auto-detection). Parameters
that the producer component does not know stay query parameters, and an
explicit {{queryParameters}} option is kept as is.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)