testapps/TestHttpFunction/Function.cs (18 lines of code) (raw):
using Amazon.Lambda.Core;
using Amazon.Lambda.APIGatewayEvents;
using System.Net;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace TestHttpFunction;
public class Function
{
public APIGatewayHttpApiV2ProxyResponse FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
{
var response = new APIGatewayHttpApiV2ProxyResponse
{
StatusCode = (int)HttpStatusCode.OK,
Body = "Making HTTP Calls",
Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } }
};
return response;
}
}