I'm trying to have my Api-Gateway map application/x-www-form-urlencoded to json using this solution: How to pass a params from POST to AWS Lambda from Amazon API Gateway
But so far my lambda get successfully triggered only my request.body is always null. If anyone know how to handle that with .net-core c# I'd really appreciate insight.
Here's what my serverless lambda function looks like so far I receive the timestamp but nothing regarding the request.body
public async Task<APIGatewayProxyResponse> Post(APIGatewayProxyRequest request, ILambdaContext context)
{
var webHook = new WebHookClient("https://{urlHiddenForObviousReasons}");
var body = new BodyModel
{
Content = $"Trigger @ {DateTime.UtcNow}, {request.Body}"
};
await webHook.PostMessage(body);
var response = new APIGatewayProxyResponse
{
StatusCode = (int)HttpStatusCode.OK,
Body = "Alert received.",
Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } }
};
return response;
}
please note that if I use Proxy Integration instead the form values get passed, I want to use mapping so I can have two client using the same api with different post method and have the lambda only parse json. Example of setting that end up passing the form values in this way: key=1&steamid=1¬etitle=ARK-ALARM%3A+06%2F17+%40+16%3A24+on+Paleolithic+Ark+-+The+Island%2C+ALARM+'Base'+IN+'The+Hidden+Lake'+WAS+TRIPPED!&message=...