public APIGatewayHttpApiV2ProxyResponse DivideFunctionHandler()

in playground/Lambda/WebCalculatorFunctions/Functions.cs [88:106]


    public APIGatewayHttpApiV2ProxyResponse DivideFunctionHandler(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 total = x / (double)y;
            context.Logger.LogInformation($"Dividing {x} by {y} equals {total}");
            var response = new APIGatewayHttpApiV2ProxyResponse
            {
                StatusCode = 200,
                Headers = new Dictionary<string, string>
            {
                {"Content-Type", "application/json" }
            },
                Body = total.ToString()
            };

            return response;
        }, request, context);