如果AWS Lambda函数必须返回空的响应体,必须确保在返回前创建一个空字符串(或者空的JSON对象dict)。以下是一个python示例:
def lambda_handler(event, context):
# Your function code here....
return ""
或
def lambda_handler(event, context):
# Your function code here....
return {}
这意味着空字符串或空的JSON对象将会被AWS API网关接受并成功返回。