Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18782

Apache camel http component HTTP_PATH header not working with toD

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.18.3, 3.19.0
    • 3.18.5, 3.20.0
    • camel-http
    • None
    • Unknown

    Description

      I tried to make work the example in camel toD eip documentation page

      from("direct:login")
      .setHeader(Exchange.HTTP_PATH, simple("/login"))
      .setHeader(Exchange.HTTP_QUERY, simple("userid=${header.userName}"))
      .toD("http:myloginserver:8080")
      .removeHeader(Exchange.HTTP_PATH)
      .removeHeader(Exchange.HTTP_QUERY); 

      but the header Exchange.HTTP_PATH is not used, so as result the following url is called:

      http://myloginserver:8080?userid=xxx 

      and not

      http://myloginserver:8080/login?userid=xxx

      I debugged the code I found that the issue could be in the class org.apache.camel.http.base.HttpSendDynamicAware in the method createPreProcessor at line 96. 
      In this method the url in toD is parsed and the path is an empty string "", and it's not checked if the Exchange.HTTP_PATH is set. 
      I'm upgrading from camel 3.11.x and it used to work, but in that version there isn't the class HttpSendDynamicAware.

      Is this the expected behavior?

      Is there a way to make it work without changing the code?

      Thanks

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            landal79 Alex Landini
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: