Alex Landini created CAMEL-18782:
------------------------------------
Summary: Apache camel http component HTTP_PATH header not working
with toD
Key: CAMEL-18782
URL: https://issues.apache.org/jira/browse/CAMEL-18782
Project: Camel
Issue Type: Bug
Affects Versions: 3.18.3
Reporter: Alex Landini
I tried to make work the example in camel toD eip documentation page
{code:java}
from("direct:login")
.setHeader(Exchange.HTTP_PATH, simple("/login"))
.setHeader(Exchange.HTTP_QUERY, simple("userid=${header.userName}"))
.toD("http:myloginserver:8080")
.removeHeader(Exchange.HTTP_PATH)
.removeHeader(Exchange.HTTP_QUERY); {code}
but the header Exchange.HTTP_PATH is not used, so as result the following url
is called:
{code:java}
http://myloginserver:8080?userid=xxx {code}
and not
{code:java}
http://myloginserver:8080/login?userid=xxx{code}
I debugged the code I found that the issue could be in the class
org.apache.camel.http.base.HttpSendDynamicAware in the method
createPreProcessor at line 96.
In this method the url in toD is parsed and the path is an empty string "", and
it's not checked if the Exchange.HTTP_PATH is set.
I'm upgrading from camel 3.11.x and it used to work, but in that version there
isn't the class HttpSendDynamicAware.
Is this the expected behavior?
Is there a way to make it work without changing the code?
Thanks
--
This message was sent by Atlassian Jira
(v8.20.10#820010)