How to catch the message body after an http error?
Hello everydody,
I send a message in a query.
But if the http response code isn't 200, I want to send my original message in a log (a log in my example but in a queue in my route).
In the cSetHeader, I get the body with the simple expression: "${Body}".
In the cHttp, I added the parameter throwExceptionOnFailure=false to retrieve the error.
After sending in http method, if the http return code isn't 200, I replace the body with cSetBody ("${headers.Body}").
My problem is when I get the message before the cHttp, I have an http error 400 (Bad Request) while this is a http 404 error.
Do you have an idea to resolve this problem ?