(err, res)
| 9 | exports.handler = (event, context, callback) => { |
| 10 | // Callback to finish response |
| 11 | const done = (err, res) => callback(null, { |
| 12 | statusCode: err ? '400' : '200', |
| 13 | body: err ? err.message : JSON.stringify(res), |
| 14 | headers: { |
| 15 | 'Content-Type': 'application/json' |
| 16 | } |
| 17 | }) |
| 18 | // To support mock testing, accept object not just strings |
| 19 | if (typeof event.body === 'string') { event.body = JSON.parse(event.body) } |
| 20 | switch (event.httpMethod) { |