3
votes

I'm trying to deploy a lambda function with aws api gateway. I was able to succesfully deploy and test POST and GET methods with Content-Type: application/json by following this blog: http://kennbrodhagen.net/2015/12/06/how-to-create-a-request-object-for-your-lambda-event-from-api-gateway/

I want my same lambda function to handle requests of content-type : text/plain, x-www-form-urlencoded also.

The problem with integration template is that we have to define the content-type before hand. So if I make a integration template of Content-type: text/plain how can I call that integration template when the api request of text/plain is made to the url. How can I invoke different integration templates based on the Content-Type of the api request?

any tips on that?

Thanks.

1

1 Answers

1
votes

I don't know whether I got your problem right r not.

From my understanding if you are passing any header information or query string parameters and the content type is text/plain you can map the template like this

{
    "prod_Id" : "$input.params('prod_Id')"
}

where product id can be the header or query string parameter.

you can find it in my blog in 'how to pass query string section