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. :logger => Rails.logger do |m|
m.insert_before ActionDispatch::ParamsParser, Rack::RespondToMalformedFormats
end
Rails 2
TODO
REQUIREMENTS
-
Rack
LICENSE
MIT