Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
2.16.1
-
None
-
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