diff --git a/src/keys.js b/src/keys.js index c8394e9..7065a7f 100644 --- a/src/keys.js +++ b/src/keys.js @@ -9,7 +9,13 @@ export const handler = async (event, context, callback) => { return; } - const body = utils.normalizeBody(querystring.parse(event.body)); + let body; + const contentType = event.headers['Content-Type'].split(';')[0]; + if (contentType === 'application/json') { + body = utils.normalizeBody(JSON.parse(event.body)); + } else { + body = utils.normalizeBody(querystring.parse(event.body)); + } let user; let device;