-1

I am binding the apis from aws but didn't httpMethod didnot Identified I didn't get why this happen? I already mapped the integration request in get request of api-gateway. Is there something that I missed?

Lambda function is shown below:

exports.handleHttpRequest = function (request, context, callback) {
    console.log('---------', request, request.httpMethod);
    switch (request.httpMethod) {
        case 'GET': {
        
            callback(null, "get case run");
            break;
        }
        case 'POST': {
            callback(null, "post Case run");
            break;
        }
        default:
            callback(null, "run default case");
    }
}
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Kiwi Rupela
  • 2,238
  • 5
  • 24
  • 44

1 Answers1

1

You can find your answer in this link here at stackoverflow:

How to get the HTTP method in AWS Lambda?

You need to send it throught context object from API Gateway > Mapping Tempates. Then you can just invoke the context.httpMethod available at your Lambda function.

You can find it here at aws docs.