Skip to content

Instantly share code, notes, and snippets.

@kennbrodhagen
Last active November 27, 2015 03:12
Show Gist options
  • Save kennbrodhagen/a6b864602587bcd05248 to your computer and use it in GitHub Desktop.
Save kennbrodhagen/a6b864602587bcd05248 to your computer and use it in GitHub Desktop.
test-http-request-lambda
curl -H "Authorization: Basic 1234" \
-H "X-Custom-Header: test-value" \
"https://8nimdxyyo1.execute-api.us-east-1.amazonaws.com/stage/example/ABCD?sort=ascending"
{
"method": "GET",
"headers": {
"Authorization": "Basic 1234",
"X-Custom-Header": "test-value"
},
"params": {
"id": "ABCD"
},
"query": {
"sort": "ascending"
}
}
exports.handler = function(event, context) {
console.log('test-http-request-lambda');
console.log('Method:', event.method);
console.log('Headers:', event.headers);
console.log('URL Parameters', event.params);
console.log('Query Parameters', event.query);
context.succeed('Hooray!');
};
{
"body" : $input.json('$'),
"headers": {
#foreach($param in $input.params().header.keySet())
"$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end
#end
},
"method": "$context.httpMethod",
"params": {
#foreach($param in $input.params().path.keySet())
"$param": "$util.escapeJavaScript($input.params().path.get($param))" #if($foreach.hasNext),#end
#end
},
"query": {
#foreach($param in $input.params().querystring.keySet())
"$param": "$util.escapeJavaScript($input.params().querystring.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