diff --git a/README.md b/README.md index e914cca..c2a1972 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,6 @@ to the integration request mapping, separating headers by a `:`. For example: Remember, don't forget the `,`. Then do the same as you did for Content-Type in the header mapping, e.g. `integration.response.body.Set-Cookie`. + + +For JSON body posts, add the line `"body": $input.json('$'),` into the integration request mapping. diff --git a/index.js b/index.js index bbd8aa9..6c551c0 100644 --- a/index.js +++ b/index.js @@ -78,6 +78,13 @@ function mapEvent( event){ } request.pathParams = parseParamString(event.pathParams); + if (event.body) { + //if json body, then load it in; + //depends on requestTemplates line: "body": $input.json('$') + request.body = event.body; + request._body = true; + } + request.method = event["http-method"]; request.url = reconstructUrl(event['resource-path'],request); delete request.allParams;