Skip to content

Instantly share code, notes, and snippets.

@MikeGarde
Created December 6, 2018 16:58
Show Gist options
  • Select an option

  • Save MikeGarde/e7abffcf63bab6aaba9b9e87695e68e3 to your computer and use it in GitHub Desktop.

Select an option

Save MikeGarde/e7abffcf63bab6aaba9b9e87695e68e3 to your computer and use it in GitHub Desktop.

Revisions

  1. MikeGarde created this gist Dec 6, 2018.
    19 changes: 19 additions & 0 deletions simpleXmlLambdaResponse.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    var parseString = require('xml2js').parseString;

    exports.handler = function (event, context, callback) {

    parseString(event.body, function (err, result) {
    event.body = result;
    let respondToGateway = {
    statusCode: '200',
    body : JSON.stringify({
    event: event,
    context: context
    }),
    headers : {
    'Content-Type': 'application/json'
    }
    };
    callback(null, respondToGateway);
    });
    };