Closed
Description
Oddly, this bug report script does not fail, even though "application/vnd.api+json" is not registered as a mime type. I really hoped to produce a failure with the bug report template.
I can show this bug by generating a fresh rails app as follows:
mkdir recreate_bug
echo "2.3.0" >> recreate_bug/.ruby-version
cd recreate_bug
echo "source 'https://rubygems.org/'" >> Gemfile
echo "gem 'rails', github: 'rails/rails'" >> Gemfile
gem install bundler --no-ri --no-rdoc
bundle
rails new --api --force .
sed -i "s/gem 'rails.*$/gem 'rails', github: 'rails\/rails'/g" Gemfile
bundle
spring stop
rails g scaffold Bug
rake db:migrate
echo "Mime::Type.unregister :json" >> config/initializers/mime_types.rb
echo "Mime::Type.register 'application/json', :json, %w( text/x-json application/jsonrequest application/vnd.api+json )" >> config/initializers/mime_types.rb
rails s
Now just curl:
curl -XPOST -H 'Content-Type: application/vnd.api+json' http://localhost:3000/bugs -d '{"maybe_a_bug": true}'
Your server window should show that it wasn't processed properly:
Processing by BugsController#create as */*
Parameters: {"bug"=>{}}
I pushed an app created this way (includes a test case) to: https://github.com/rthbound/una-otra ...