Created
March 12, 2016 17:13
-
-
Save jakelodwick/d291fdcd42e47b807cca to your computer and use it in GitHub Desktop.
AWS API Gateway - Integration Request - Mapping Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#* | |
Via <http://kennbrodhagen.net/2015/12/06/how-to-create-a-request-object-for-your-lambda-event-from-api-gateway/>. | |
This mapping template formats most information that API Gateway receives, for easy use in a Lambda function (or whatever). | |
Not sure why the same effect isn't achieved with the "Input passthrough" option! | |
*# | |
{ | |
"method": "$context.httpMethod", | |
"body" : $input.json('$'), | |
"headers": { | |
#foreach($param in $input.params().header.keySet()) | |
"$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end | |
#end | |
}, | |
"queryParams": { | |
#foreach($param in $input.params().querystring.keySet()) | |
"$param": "$util.escapeJavaScript($input.params().querystring.get($param))" #if($foreach.hasNext),#end | |
#end | |
}, | |
"pathParams": { | |
#foreach($param in $input.params().path.keySet()) | |
"$param": "$util.escapeJavaScript($input.params().path.get($param))" #if($foreach.hasNext),#end | |
#end | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment