These are chat archives for mentum/lambdaws

14th
Dec 2015
Robert D. French
@robertdfrench
Dec 14 2015 17:08
@aphelionz you wanting to return something other than json?
I think API Gateway tries to assume that anything it gets is a string.
I tried to get a lambda to return html one time and I ended up having to write one of those response transform scripts in API Gateway, and I was able to set the content type there
Robert D. French
@robertdfrench
Dec 14 2015 17:17
I dunno if you are the same boat I was, but I put the following mapping template on the integration response for my API method:
#set($inputRoot = $input.path('$')) 
$inputRoot.htmldocument
And then I had my lambda return an object with an 'htmldocument' field containing a string that was my html document
you can set a content-type for integration mappings, so I set 'text/html'
Robert D. French
@robertdfrench
Dec 14 2015 17:26
Ooh, I forgot I also had to add an empty Response Model with content-type 'text/html' under Method Response, otherwise it wil still respond with "Content-type: text/json" header. But that was just a lucky guess, and I don't really think it's the right way to accomplish what I set out to do