public APIGatewayHttpApiV2ProxyResponse AddFunctionHandler()

in playground/Lambda/WebCalculatorFunctions/Functions.cs [28:46]


    public APIGatewayHttpApiV2ProxyResponse AddFunctionHandler(APIGatewayHttpApiV2ProxyRequest request, ILambdaContext context)
            => AWSLambdaWrapper.Trace(_traceProvider, (request, context) =>
            {
                var x = (int)Convert.ChangeType(request.PathParameters["x"], typeof(int));
                var y = (int)Convert.ChangeType(request.PathParameters["y"], typeof(int));
                var sum = x + y;
                context.Logger.LogInformation($"Adding {x} with {y} is {sum}");
                var response = new APIGatewayHttpApiV2ProxyResponse
                {
                    StatusCode = 200,
                    Headers = new Dictionary<string, string>
                    {
                        {"Content-Type", "application/json" }
                    },
                    Body = sum.ToString()
                };

                return response;
            }, request, context);