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

http4 and Exchange.HTTP_URI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 2.16.1
    • None
    • camel-http4
    • None
    • jdk7, mac

    • Unknown

    Description

      It seems that when using Exchange.HTTP_URI, the options added in here doesn't get stripped off the actual request and is being interpretted as part of the url rather than as an endpoint option.

      This is a working example

      from("direct:start").
      setHeader(Exchange.HTTP_METHOD, constant("POST")).
      to("http4:localhost:8080/path?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass");
      

      The output from apache httpclient logging is showing the Authorization header being correctly set

      2015-12-07 11:29:51,139 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /path HTTP/1.1
      2015-12-07 11:29:51,140 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: Basic bXlVc2VyOm15UGFzcw==
      

      Now we do the same but use Exchange.HTTP_URI

      from("direct:start").
      setHeader(Exchange.HTTP_METHOD, constant("POST")).
      setHeader(Exchange.HTTP_URI, constant("http4://localhost:8080/newPath?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass")).
      // deliberately changed settings here to verify we are not hitting it
      to("https4:host:80/path");
      

      This is the output of apache httpclient logs

      2015-12-07 11:32:19,595 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /newPath?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass HTTP/1.1
      

      Notice the missing Authorization header and the path includes the uri options as well

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            mtran Minh Tran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: