Skip to content

Commit 585bd52

Browse files
committed
install robust_params_parser to get rid of 500 status code when receiving requests that send the header content-type: application/json but no valid json in body
1 parent c2f0762 commit 585bd52

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ source 'https://rubygems.org' do
124124
gem 'compass-rails'
125125
gem 'strong_parameters'
126126
gem 'postgres_ext'
127+
gem 'robust_params_parser'
127128
# ElasticSearch client
128129
gem 'tire'
129130
# /DROP BEFORE RAILS 4

Diff for: config/application.rb

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class Application < Rails::Application
4040
config.rakismet.url = ENV['AKISMET_URL']
4141

4242
config.exceptions_app = self.routes
43+
44+
# DROP BEFORE RAILS 4
45+
config.middleware.swap ActionDispatch::ParamsParser, ::RobustParamsParser, {}
4346
end
4447
end
4548

0 commit comments

Comments
 (0)