diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-06-15 12:54:26 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-06-21 07:17:14 +0900 |
commit | ddb6d788d6a611fd1ba6cf92ad6d1342079517a8 (patch) | |
tree | ce404d935851ec89e426e7538067276cc5a7e885 /railties/lib | |
parent | 3218459c28737071fe4424cd375c1b06a5c317df (diff) | |
download | rails-ddb6d788d6a611fd1ba6cf92ad6d1342079517a8.tar.gz rails-ddb6d788d6a611fd1ba6cf92ad6d1342079517a8.tar.bz2 rails-ddb6d788d6a611fd1ba6cf92ad6d1342079517a8.zip |
Make `ActionDispatch::Response#content_type` behavior configurable
I changed return value of `ActionDispatch::Response#content_type` in #36034.
But this change seems to an obstacle to upgrading. https://github.com/rails/rails/pull/36034#issuecomment-498795893
Therefore, I restored the behavior of `ActionDispatch::Response#content_type`
to 5.2 and deprecated old behavior. Also, made it possible to control the
behavior with the config.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index da1c433e52..72c7ff169f 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -129,6 +129,7 @@ module Rails if respond_to?(:action_dispatch) action_dispatch.use_cookies_with_metadata = true + action_dispatch.return_only_media_type_on_content_type = false end if respond_to?(:action_mailer) diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt index d25552e923..abb03e761b 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt @@ -16,6 +16,9 @@ # It's best enabled when your entire app is migrated and stable on 6.0. # Rails.application.config.action_dispatch.use_cookies_with_metadata = true +# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. +# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = true + # Return false instead of self when enqueuing is aborted from a callback. # Rails.application.config.active_job.return_false_on_aborted_enqueue = true |