Authorization header is missing as part of default headers for camel-http4 so I tried to assign Authorization header to my exchange as below:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="timer://foo?fixedRate=true&period=60000"/>
<log message="timer has begun"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Authorization">
<constant>
Bearer <tokenhere>==
</constant>
<setBody>
<constant>
</constant>
</setBody>
<to uri="http4://myhost.com/api/v3.1/listening/query/stream"/>
</route>
</camelContext>
The header is not getting set in the request header. One of our potential email providers uses a bearer authentication token. This means they are using an Oauth machinery for credential verification. In the curl format they use something like: curl -X "POST" "https://vendor_url" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d "[YOUR DATA HERE]". I don’t see anything in the camel-http4 components that exposes the additional header entry for Authorization like Content-Type.
Looking at class org.apache.camel.component.http4.HttpProducer, I could not find the logic that was assigning the arbitrary headers to the request, and looking at the requests in Fiddler did not display such headers. I need help on how I can use camel-http4 for this without having to go to HttpClient code base.