If you have ever upgraded Rails from 5.2 to 6.0, you might have run into issues with changes that had been made to the value of ActionDispatch::Response#content_type between the two versions.
If you have been lucky, you might not have even noticed there was a problem until Rails 6.0, after coming across this deprecation message:
Rails 6.1 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead.
What happened with ActionDispatch::Response#content_type between Rails 5.2 to 6.1? In this article, we will go into some background to learn what this method does, look at the differences in ActionDispatch::Response#content_type’s return value between the several Rails versions, and how you can fix the problem if you come across it in your codebase.