You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Sergey Zhemzhitsky (Jira)" <ji...@apache.org> on 2021/09/14 12:29:00 UTC
[jira] [Created] (CAMEL-16957) NettyHttpHelper appends slash to an
URI in case of empty CamelHttpPath
Sergey Zhemzhitsky created CAMEL-16957:
------------------------------------------
Summary: NettyHttpHelper appends slash to an URI in case of empty CamelHttpPath
Key: CAMEL-16957
URL: https://issues.apache.org/jira/browse/CAMEL-16957
Project: Camel
Issue Type: Bug
Components: camel-netty-http
Affects Versions: 3.11.0
Reporter: Sergey Zhemzhitsky
NettyHttpHelper appends slash to an URI in case of empty CamelHttpPath possibly leading to 404/NOT_FOUND errors.
Test to reproduce
{code:java}
@Test
public void testEmptyPathDoesNotEndsWithSlash() throws Exception {
MockEndpoint input = getMockEndpoint("mock:input");
input.expectedBodiesReceived("Hello World");
input.expectedHeaderReceived(Exchange.HTTP_PATH, "");
input.expectedHeaderReceived(Exchange.HTTP_URI, "/foo");
template.request("netty-http:http://localhost:{{port}}/foo", exchange -> {
Message in = exchange.getIn();
in.setBody("Hello World");
in.setHeader(Exchange.HTTP_PATH, "");
});
assertMockEndpointsSatisfied();
}
{code}
... fails with
{code:none}
java.lang.AssertionError: mock://input Header with name CamelHttpPath for message: 0. Expected: <> but was: </>
Expected :<>
Actual :</>
<Click to see difference>
at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:1782)
at org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:1759)
at org.apache.camel.component.mock.MockEndpoint$4.assertOnIndex(MockEndpoint.java:608)
at org.apache.camel.component.mock.MockEndpoint.onExchange(MockEndpoint.java:1599)
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)