The HTTP Request raises HTTP:CONNECTIVITY, so processing moves to the flow's On Error Propagate handler. Inside that handler, the variable httpStatus is explicitly set to 200, and the payload is changed to "Error in processing your request."
However, because the handler is On Error Propagate, the Mule event remains in an error state after the handler completes. Therefore, the HTTP Listener uses its configured Error Response, not its normal Response configuration.
The exhibit shows that the Error Response status code is:
#[vars.httpStatus]
and its body is explicitly:
output text/plain --- error.description
Consequently, the status code is 200 because the error handler assigned that value to vars.httpStatus, while the body comes from error.description, which contains the description of the HTTP:CONNECTIVITY error. The payload set inside the error handler is not the expression used by the listener's configured Error Response.
MuleSoft documents that unsuccessful listener executions use the error-response definition and that status, body, headers, and other fields can use flow variables and DataWeave expressions.
Reference topics: HTTP Listener Error Response; On Error Propagate; Mule error object; error.description; response status variables.
Official documentation: https://docs.mulesoft.com/http-connector/latest/http-listener-ref
===============================================================
Submit