Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.11.0
-
None
-
Unknown
Description
NettyHttpHelper appends slash to an URI in case of empty CamelHttpPath possibly leading to 404/NOT_FOUND errors.
Test to reproduce
@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(); }
... fails with
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)
Attachments
Issue Links
- is related to
-
CAMEL-16906 Platform-http components fail when using unmarshal
- Resolved
- links to