Return BadRequest error code for malformed request

Test Plan: Tested it on the sdmain codebase

Reviewers: hv, aa, kt, j

Reviewed By: kt, j

Differential Revision: http://phabricator.scale-data.com/D2312