Hi,

The documentation of the camel-ahc component (http://camel.apache.org/ahc.html 
) says:

"Message Body

Camel will store the HTTP response from the external server on the OUT body. 
All headers from the IN message will be copied to the OUT message, so headers 
are preserved during routing. Additionally Camel will add the HTTP response 
headers as well to the OUT message headers."

However this is not how it is implemented:
A new (empty) DefaultMessage will be created in the 
DefaultAhcBinding.onStatusReceived() method by calling exchange.getOut(). 
Afterwards only the HTTP-Response and the incoming HTTP headers are set to the 
out message. I discussed this with Aki Yoshida and he believes that the 
implemented behavior is the correct one as otherwise request and response 
messages would be mixed.

>From my perspective both approaches make sense, however the documentation and 
>the implementation should match. So either the line 
>(exchange.getOut().setHeaders(exchange.getIn().getAllHeaders());) should be 
>added to the DefaultBinding.onStatusReceived() method, or the documentation 
>should be adapted like "... OUT body. Camel will replace the OUT message 
>headers by the HTTP response headers, so headers are not preserved during 
>routing."

What do you think.

Best regards
Stephan

Reply via email to