You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2021/09/15 04:33:00 UTC
[jira] [Assigned] (CAMEL-16957) NettyHttpHelper appends slash to an
URI in case of empty CamelHttpPath
[ https://issues.apache.org/jira/browse/CAMEL-16957?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrea Cosentino reassigned CAMEL-16957:
----------------------------------------
Assignee: Andrea Cosentino
> 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
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 3.7.6, 3.11.3, 3.12.0
>
>
> 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)