ian_eve
ian_eve

Reputation: 107

Apache Camel HTTP4 component ignores Date: Header

I'm using Apache Camel's HTTP 4 component for performing a HTTP-PUT request. Before sending the request, I set custom and application dependent headers. One of the header key is 'Date'.

But unfortunately, Camel-HTTP4 ignores the Date-Header and does not send it to the remote server:

.setHeader("Date", simple("${date:now:EEE, dd MMM yyyy HH:mm:ss z}"))
.toD("https4:{{myprops.uri}}?bridgeEndpoint=true" +
    "&throwExceptionOnFailure=false" +
    "&mapHttpMessageBody=true" +
    "&httpMethod=" + HttpMethods.PUT +
    "&connectTimeout={{myprops.connectTimeout}}" +
    "&socketTimeout={{myprops.socketTimeout}}").id("https-connect")
 // Date is not sent

Does anybody know why the header is removed and how I can configure that the header is kept?

Thx

Upvotes: 0

Views: 455

Answers (1)

lbma
lbma

Reputation: 132

Add &date=${header.Date}to the .toD() parameters, because it is a custom parameter.

There are some http headers that you don't have to add to the parameters if you define them before the http call. In this case for example you could use .setHeader(Exchange.HTTP_METHOD, constant(HttpMethod.PUT))

Upvotes: 0

Related Questions