问题
I'm passing the addition key-value pairs from lambda function, same as mention in aws labs. Then in API Gateway I have setup the body mapping templates in integration request. (Check this).
But when request goes to the endpoint (PHP) then I'm unable to get any data. It is empty array print_r($_REQUEST);
I checked cloudWatch this is what it is showing.
Endpoint request body after transformations:
{ "userData" : "{"city":"USA","Name":"Sanket","id":3}" }
Additional info -
When I print print_r($_REQUEST);
then it is empty array but when I print $request->getContent();
it shows all the data.
UPDATE - I Additional information here
回答1:
You have mentioned that you have setup body mapping template in integration request. If you want to integrate a response then you should setup it in integration response, not in integration request.
来源:https://stackoverflow.com/questions/46954296/how-to-pass-headers-from-aws-api-gateway