Handle bad JSON requests to your Rails API
One of the main problem I faced while building JSON APIs using Ruby on Rails was around making sure that the API consistently returns JSON responses for all scenarios including when the request payload is not valid JSON.
By default Rails returns HTML response in case of invalid parameters. So I wrote this gem which catches such errors and makes sure to return JSON response.
https://github.com/prathamesh-sonpatki/bad_json_request_handler
Post a comment