[ https://issues.apache.org/jira/browse/CAMEL-15420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17180030#comment-17180030 ]
Chandrakant Hardahe commented on CAMEL-15420: --------------------------------------------- [~ArtemSt], Did you refer the doc [https://camel.apache.org/components/latest/http-component.html] ? It says,"URI parameters. Will override existing URI parameters set directly on the endpoint." I hope it answers the query. > camel-http dynamic aware removes Exchange.HTTP_QUERY header if > Exchange.HTTP_PATH header not specified > ------------------------------------------------------------------------------------------------------ > > Key: CAMEL-15420 > URL: https://issues.apache.org/jira/browse/CAMEL-15420 > Project: Camel > Issue Type: Bug > Components: camel-http-common > Affects Versions: 2.24.3, 3.4.3 > Reporter: Artem St > Priority: Minor > Fix For: 3.5.0 > > Attachments: HttpSendDynamicAwareHeadersTest.java > > > If http path specified in endpoint uri instead of Exchange.HTTP_PATH header > than dynamic aware ignores Exchange.HTTP_QUERY and set it as null. > Sending message to route > {code:java} > from("direct:dynamicAware") > .setHeader(Exchange.HTTP_PATH, constant("dynamicAware")) > .setHeader(Exchange.HTTP_QUERY, constant("par1=val1&par2=val2")) > .toD("http://localhost:" + localServer.getLocalPort());{code} > will return exchange with getIn().getHeader(Exchange.HTTP_QUERY) equal to > "par1=val1&par2=val2". > But, sending message to route > {code:java} > from("direct:dynamicAwareWithoutPathHeader") > .setHeader(Exchange.HTTP_QUERY, constant("par1=val1&par2=val2")) > .toD("http://localhost:" + localServer.getLocalPort() + > "/dynamicAware");{code} > removes header Exchange.HTTP_QUERY from result. > > Here is full code of test: (also attached as a .java file) > {code:java} > public class HttpSendDynamicAwareHeadersTest extends BaseHttpTest { > private HttpServer localServer; > @BeforeEach > @Override > public void setUp() throws Exception { > localServer = ServerBootstrap.bootstrap(). > setHttpProcessor(getBasicHttpProcessor()). > setConnectionReuseStrategy(getConnectionReuseStrategy()). > setResponseFactory(getHttpResponseFactory()). > setExpectationVerifier(getHttpExpectationVerifier()). > setSslContext(getSSLContext()). > registerHandler("/dynamicAware", new BasicValidationHandler(GET.name(), > null, null, null)). > create(); > localServer.start(); > super.setUp(); > } > @AfterEach > @Override > public void tearDown() throws Exception { > super.tearDown(); > if (localServer != null) { > localServer.stop(); > } > } > @Override > protected RoutesBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > from("direct:dynamicAware") > .setHeader(Exchange.HTTP_PATH, constant("dynamicAware")) > .setHeader(Exchange.HTTP_QUERY, constant("par1=val1&par2=val2")) > .toD("http://localhost:" + localServer.getLocalPort()); > from("direct:dynamicAwareWithoutPathHeader") > .setHeader(Exchange.HTTP_QUERY, constant("par1=val1&par2=val2")) > .toD("http://localhost:" + localServer.getLocalPort() + "/dynamicAware"); > } > }; > } > @Test > public void testDynamicAwareHeaders() throws Exception { > Exchange e = fluentTemplate.to("direct:dynamicAware").send(); > assertNotNull(e.getIn().getHeader(Exchange.HTTP_QUERY)); > e = fluentTemplate.to("direct:dynamicAwareWithoutPathHeader").send(); > assertNotNull(e.getIn().getHeader(Exchange.HTTP_QUERY)); > } > }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)