aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/railtie.rb
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-06-15 12:54:26 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-06-21 07:17:14 +0900
commitddb6d788d6a611fd1ba6cf92ad6d1342079517a8 (patch)
treece404d935851ec89e426e7538067276cc5a7e885 /actionpack/lib/action_dispatch/railtie.rb
parent3218459c28737071fe4424cd375c1b06a5c317df (diff)
downloadrails-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 'actionpack/lib/action_dispatch/railtie.rb')
-rw-r--r--actionpack/lib/action_dispatch/railtie.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb
index 5f711c7348..66f90980b9 100644
--- a/actionpack/lib/action_dispatch/railtie.rb
+++ b/actionpack/lib/action_dispatch/railtie.rb
@@ -23,6 +23,7 @@ module ActionDispatch
config.action_dispatch.use_authenticated_cookie_encryption = false
config.action_dispatch.use_cookies_with_metadata = false
config.action_dispatch.perform_deep_munge = true
+ config.action_dispatch.return_only_media_type_on_content_type = true
config.action_dispatch.default_headers = {
"X-Frame-Options" => "SAMEORIGIN",
@@ -43,6 +44,7 @@ module ActionDispatch
ActionDispatch::Request::Utils.perform_deep_munge = app.config.action_dispatch.perform_deep_munge
ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding
ActionDispatch::Response.default_headers = app.config.action_dispatch.default_headers
+ ActionDispatch::Response.return_only_media_type_on_content_type = app.config.action_dispatch.return_only_media_type_on_content_type
ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)