Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Key endpoint gets both JSON and urlencoded data
Browse files Browse the repository at this point in the history
  • Loading branch information
vvondra committed Aug 5, 2018
1 parent 360092e commit 807f6f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 807f6f0

Please sign in to comment.