Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rails currently returns HTML 500 responses when sent unparsable XML and JSON and gives no way to rescue and handle it
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.4.4
 Project Readme

Rack Middleware - respond_to_malformed_formats¶ ↑

DESCRIPTION¶ ↑

Return graceful and well formatted errors in the same format of the malformed input for XML, JSON and YAML.

Rails will return HTML 500 errors when you send it badly formatted XML or JSON or YAML. It would be nicer if an XML or JSON client actually received the response back in the same format and also received an HTTP 400 error code which is reserved for malformed syntax errors.

INSTALL¶ ↑

Add rack_respond_to_malformed_formats to your Gemfile

gem 'rack_respond_to_malformed_formats', :require => 'rack/respond_to_malformed_formats'

Then run:

$ bundle install

Rails 3¶ ↑

Create an initializer file in config/initializers/respond_to_malformed_formats.rb

Rails.application.middleware.with_options :logger => Rails.logger do |m|
  m.insert_before ActionDispatch::ParamsParser, Rack::RespondToMalformedFormats
end

Rails 2¶ ↑

TODO

REQUIREMENTS¶ ↑

  • Rack

LICENSE¶ ↑

MIT