I am using Lambda function to return custom responses for my api endpoint.
i am returning the responses like this -
response404 = {
"statusCode": 404,
"body": json.dumps({"message": "Not Found"})
}
if httpStatusCode == "200":
return output_response
else:
return response404
It's returning the response but not setting the status code in Postman.
What do i need to do to set the status to 404 in postman as well.
This can be done by setting up a Lambda Proxy Integration.
The response of the lambda function needs to be in this format ->
response = {
"statusCode": 404,
"headers": {
"Content-Type" : "application/json"
},
"body": json.dumps(error_handler)
}
return response