Last active
February 12, 2020 05:12
-
-
Save secretshardul/3497268b07cb3a96e5f5015c18f5af34 to your computer and use it in GitHub Desktop.
Lambda integration to parse x-www-form-urlencoded. The handler returns back the event as it is.
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
var qs = require('querystring') | |
exports.handler = async (event) => { | |
return event | |
}; |
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
{ | |
"data": { | |
#foreach( $token in $input.path('$').split('&') ) | |
#set( $keyVal = $token.split('=') ) | |
#set( $keyValSize = $keyVal.size() ) | |
#if( $keyValSize >= 1 ) | |
#set( $key = $util.urlDecode($keyVal[0]) ) | |
#if( $keyValSize >= 2 ) | |
#set( $val = $util.urlDecode($keyVal[1]) ) | |
#else | |
#set( $val = '' ) | |
#end | |
"$key": "$val"#if($foreach.hasNext),#end | |
#end | |
#end | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment