Hi Team,

I hope someone can help us.

We have to do a simple rest callout with POST method and http
as producercomponent:
If we use POST as method, the redirect in the http component is not
fulfilled. (If we use GET it works)

After some investigation we realized that we have to configure the
http-client to use LaxRedirectStrategy
But I have no idea how to access the client within camel.

Do you have any ideas?

Simple TestRoute:

protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {

                restConfiguration()
                        .producerComponent("http")
                        .host("localhost")
                        .port((Integer) parameters.get("port"));

                from("direct:start")

.to("rest:POST:users/{id}/basic?throwExceptionOnFailure=false")
                        .log(LoggingLevel.INFO, "Received body : ${body}")
                        .to("mock:result");

            }
        };


@Override
@BeforeEach
public void setUp() throws Exception {
    super.setUp();

    redirectServer = ServerBootstrap.bootstrap()
            .setListenerPort((Integer)parameters.get("port2"))
            .setHttpProcessor(getHttpProcessor())
            .registerHandler("/*", new SimpleHandler("Donald Duck"))
            .create();
    redirectServer.start();

    localServer = ServerBootstrap.bootstrap()
            .setListenerPort((Integer)parameters.get("port"))
            .setHttpProcessor(getHttpProcessor())
            .registerHandler("/users/*", redirectTo(302,
"/redirected", redirectServer))
            .create();
    localServer.start();

Reply via email to