We have request on Nginx that always reply response 200 but need to look into response body to capture status of 'fail' or 'success'.
},
"response": {
"statusCode": 200,
"body": "{\"message\":null,\"responseData\":{\"accountList\":[{\"accountNo\":\"2491011751\",\"canAddNewLine\":true,\"msisdnList\":[]}],\"deviceAdvancePaymentWaive\":\"N\",\"ratePlanAdvancePaymentWaive\":\"Y\",\"lineDepositWaive\":\"Y\",\"newProductOfferId\":\"4062147\",\"deviceDAPAmount\":\"540\",\"orderAck\":\"Y\"},\"status\":\"fail\",\"timeStamp\":\"2023-02-14 01:37:05\",\"violations\":null}"
}
}
However, looking at request attributes documentation does not really mention on this. Is there a way to capture this as an attribute?
Gary
Hello Gary.
We often set a request attribute for capturing arguments\return value from classes and methods which work with body \ make body response on App server level (on a Java backend for example) In this situation.
With custom error rules you can set to mark requests which have 200 response code and request attribute - error: value as failed.
Nginx in our situation is only balancer or web server to serve static files.
Regards,
Romanenkov Alex