I am creating a Mock endpoint to work on a development project.
I want to throw certain response codes based on the strings in the JSON request body.
E.g.
{ "desiredResponse": "200" }
Would return a response code of 200.
{ "desiredResponse": "400" }
Would return a response code of 400.
From my understanding, this is not possible via the Mock Integration Response (Reference: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html)
Is this possible via a Lambda function? Or is there any possible workarounds for this?
Due to the nature of this project, I do not want to use request Query Strings or Header to set the response code.
I have seen the workarounds here, https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-override-request-response-parameters.html but I really need the response code to be dependant on the request data.