Skip to content

Commit

Permalink
Return error response on invalid json (#3673)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvdvleuten authored and Stevenic committed Jan 23, 2018
1 parent 63452f8 commit 40edcbf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Node/core/src/bots/ChatConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ export class ChatConnector implements IConnector, IBotStorage {
requestData += chunk
});
req.on('end', () => {
req.body = JSON.parse(requestData);
try {
req.body = JSON.parse(requestData);
} catch (err) {
logger.error('ChatConnector: receive - invalid request data received.');
res.send(400);
res.end();
return;
}

this.verifyBotFramework(req, res, next || defaultNext);
});
}
Expand Down

0 comments on commit 40edcbf

Please sign in to comment.