RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in