Rails 6.1 will return Content-Type header without modification ... use `#media_type` instead Rails 6.1 will return Content-Type header without modification ... use `#media_type` instead ruby ruby

Rails 6.1 will return Content-Type header without modification ... use `#media_type` instead


I got the same error message when I was upgrading my app from Rails 5.2.3 to Rails 6.0.0-rc1

config/application.rb

# this was the line before# config.load_defaults 5.2config.load_defaults 6.0

In my case I had to change the version from 5.2 to 6.0


You can make the warning go away by adding this to your application.rb:

config.action_dispatch.return_only_media_type_on_content_type = false

You would need to make sure that if you are using content_type anywhere in your code that you replace that with media_type before making that change.


I also got the same error message when I was upgrading my app from Rails 5.2.4 to Rails 6.0.2.1.

For me the error was being caused by an older version of Turbolinks.

Upgrading from Turbolinks 5.1.0 to 5.2.1 made the warning go away.