You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Artem St (Jira)" <ji...@apache.org> on 2022/03/10 12:57:00 UTC
[jira] [Created] (CAMEL-17773) camel-http: HttpSendDynamicAware parse uri incroectly if there are empty path and get parametrs in uri
Artem St created CAMEL-17773:
--------------------------------
Summary: camel-http: HttpSendDynamicAware parse uri incroectly if there are empty path and get parametrs in uri
Key: CAMEL-17773
URL: https://issues.apache.org/jira/browse/CAMEL-17773
Project: Camel
Issue Type: Bug
Components: camel-http
Affects Versions: 3.x
Reporter: Artem St
Attachments: HttpProducerGetRequestTest.java, HttpSendDynamicAwareWithEmptyPathTest.java
There is a simple example from the http component documentation, but configured to use HttpSendDynamicAware:
{code:java}
from("direct:start")
.toD("http://oldhost?order=123&detail=short");{code}
Sending exchange to a direct:start will return an exception:
{code:java}
Failed to resolve endpoint: http://http://oldhost due to: Failed to resolve endpoint: http://http://oldhost due to: The uri part is not configured correctly. You have duplicated the http(s) protocol.{code}
I belive, the core of the problem is how HttpSendDynamicAware parses uri. it's keeps scheme of uri if there is empty path. For example this test will not return the expected result:
{code:java}
@Test
public void testHttpsUndefinedPortParseUri() {
this.httpSendDynamicAware.setScheme("https");
DynamicAwareEntry entry = new DynamicAwareEntry("https://localhost:80/", null, null, null);
String[] result = httpSendDynamicAware.parseUri(entry);
assertEquals("localhost", result[0], "Parse should not add port if https and not specified");
}{code}
{code:java}
org.opentest4j.AssertionFailedError: Parse should not add port if https and not specified ==>
Expected :localhost
Actual :https://localhost:80/{code}
Both test classes are attached.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)