Question

I am making a http call to a flow that will call an http outbound endpoint. The outbound endpoint returns a message with http.status = 400. Until the last moment when I am in my flow the headers will show that the http.status is in fact 400.

But Mule will return the message with http.status = 500 Internal Server Error instead.

I have found this solution, but it doesn't work for me: https://stackoverflow.com/a/16486259/3510748

<set-variable variableName="http.disable.status.code.exception.check"
          value="true" />

When I set this before my http outbound endpoint http.status will change to 200 which isn't correct either.

What do I need to do to receive the correct http.status?

Was it helpful?

Solution

You can set the HTTP headers as outbound properties, so you should be able to do something like

<set-property propertyName="http.status" value="#[message.inboundProperties['http.status']]"/>

after the outbound HTTP call to respond with the exact same status. You will also need the http.disable.status.code.exception.check to prevent an exception, unless you have some other type of exception handling.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top