This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.middleware.insert_before ActionDispatch::ParamsParser, ::Rack::Robustness do |g| | |
g.no_catch_all | |
# you might need to replace this with JSON::ParserError, depending on your Rails configuration | |
# or you can catch both... | |
g.on(MultiJson::ParseError) { |ex| 400 } | |
g.content_type 'text/plain' | |
g.body{ |ex| ex.message } | |
g.ensure(true) do |ex| | |
env['rack.errors'].write(ex.message) | |
logger.warn(ex.message) |