Get aws lambda response as an HTML page

前端 未结 2 1039
我寻月下人不归
我寻月下人不归 2020-12-08 21:26

How can i get the aws lambda response as the HTML page. Please provide the step wise procedure to solve this.

2条回答
  •  一向
    一向 (楼主)
    2020-12-08 21:59

    You don't need Lambda to print out HTML.

    Adding the HTML code:

    • go to your GET method -> Integration Response -> Body Mapping Templates

    • delete application/json (by default)

    • add text/html mapping

    • in the empty field to the right, just paste your HTML (delete anything else)

    You will also need to update the content type in the Method Response:

    • expand 200 response

    • under Response Body for 200, delete application/json and add text/html with an empty model

    Then just deploy your API and you're done.

提交回复
热议问题