I am trying to achieve the same thing as this post, but I do not understand the reply there and don't have permission to ask for clarification in the comments.
I have an API Gateway endpoint that accepts a GET request, passes through some request variables to the Lambda function (implemented in Python), and returns text/html via an Empty Response Model (as described here
As described in the earlier SO question, if the Lambda function returns an HTML string and the API endpoint uses the default Output Passthrough behavior @ Integration Response, the HTML output is quoted:
"
<html>
<body>
...
</body>
</html>
"
That answer (by @ARUNBALAN NV) says "Simply store the HTML markup in a variable and return it.", but I am unsure what that means in the context of a Lambda function. Does it mean to return an "application/json" response with an element named "variableHTML"? Something like this?
"{"variableHTML": "\n<html>\n<body>\n ... \n</body>\n</html>\n"}"
I set that up & in API Gateway my Integration Response now uses a Mapping to extract the element (for 200 application/json responses) exactly as suggested:
#set($inputRoot = $input.path('$'))
$inputRoot.variableHTML .
The result is now a single dot being returned.
I have tried many variations ($input.json instead of $input.path, different content types at different stages, etc), but feel the above setup most closely matches the accepted answer from the other thread.
Any insight where I am going wrong with this will be appreciated. Thanks for reading!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…