wso2 / product-micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
204 stars 221 forks source link

[Bug]:Error code and Error message is not returned as expected in API Fault Sequence #3596

Closed VinulaUthsara closed 1 month ago

VinulaUthsara commented 2 months ago

Description

If we have an enrich mediator in an API and add a filter mediator to capture the error codes of either 0 or 601000 which includes a Payload Factory mediator in the fault sequence of an API along with a property mediator which has HTTP_SC response code of 400 followed by a respond mediator we do not get the proper response and get 202 accepted.

However, if we add the same to an InSequence of an API we can see the expected response code 400 along with the error message.

Steps to Reproduce

  1. Create an API with an inSequence and faultSequence.
  2. Add an enrich mediator in the InSequence followed by a payloadFactory mediator to return an error message and property mediator to return an HTTP_SC error code such as 400.
  3. Add a filter mediator and payloadFactory mediator in the fault sequence to filter error code 0 or 601000 followed by a payloadFactory mediator to return an error message and property mediator to return an HTTP_SC error code such as 400.
  4. Invoke the above API with a valid JSON payload to invoke the inSequence flow. We will get the expected error code 400 and error message defined in the payloadFactory mediator.
  5. Invoke the above API with an invalid JSON payload to invoke the fault sequence. We will get only 202 Accepted error code.

Affected Version(s)

4.1.0

OS, DB, other environment details and versions

No response

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response