/parsnip

rack middleware that nips parse errors in the bud before they can manifest as internal server errors

Primary LanguageRuby

Welcome to Parsnip

Parsnip is a rack middlware component primarily targeted to Rails 3.x developers creating RESTful apis. Particularly those tired of ActionDispatch::ParamsParser spewing internal server errors when clients supply malformed XML or JSON in the body of PUT/POST requests. Parsnip will find unparsable XML or JSON and return response with a status code of 400 and JSON or XML body content describing the parsing error encountered.

Getting Started

Rails: Parsnip uses the railties facility to work as a plug and play gem for Rails applications (verified with Rails 3.2.x).

  1. Add gem 'parsnip' to your Gemfile

  2. Run bundle from your project root

  3. Run rake middleware from your project root and verify that Parsnip::Middleware appears before ActionDispatch::ParamsParser