Created
December 17, 2015 21:36
-
-
Save ctulek/0e15f8d9a2faeb1e6235 to your computer and use it in GitHub Desktop.
AWS API Gateway Mapping Template to add all header, query, path, and stage parameters to JSON dynamically
This file contains 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
{ | |
"request": { | |
"context": { | |
"stage": "$context.stage" | |
}, | |
"path": { | |
#foreach( $key in $input.params().path.keySet()) | |
"$key": "$input.params().path.get($key)"#if( $velocityHasNext ),#end | |
#end | |
}, | |
"headers": { | |
#foreach( $key in $input.params().header.keySet()) | |
"$key": "$input.params().header.get($key)"#if( $velocityHasNext ),#end | |
#end | |
}, | |
"query": { | |
#foreach( $key in $input.params().querystring.keySet()) | |
"$key": "$input.params().querystring.get($key)"#if( $velocityHasNext ),#end | |
#end | |
}, | |
"stage": { | |
#foreach( $key in $stageVariables.keySet()) | |
"$key": "$stageVariables.get($key)"#if( $velocityHasNext ),#end | |
#end | |
}, | |
"body": $input.json('$') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment