diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2019-08-04 02:53:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-04 02:53:01 +0200 |
commit | 5f3848a979e6be15a4d8bedcb9c68587094094fe (patch) | |
tree | 8253c1554e5c13a4891c48f628492e8532ced9ca /actionpack/lib/action_controller | |
parent | f1f5024b918ecf303b9908f78d1a6136d9418730 (diff) | |
parent | 7cf445d3bdc466f26b4a1929822ccd34daac19a7 (diff) | |
download | rails-5f3848a979e6be15a4d8bedcb9c68587094094fe.tar.gz rails-5f3848a979e6be15a4d8bedcb9c68587094094fe.tar.bz2 rails-5f3848a979e6be15a4d8bedcb9c68587094094fe.zip |
Merge pull request #36854 from eugeneius/media_type_instead_of_content_type
Use media_type instead of content_type internally
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/renderers.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/request_forgery_protection.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb index a251c29d23..660aef4106 100644 --- a/actionpack/lib/action_controller/metal/renderers.rb +++ b/actionpack/lib/action_controller/metal/renderers.rb @@ -163,18 +163,18 @@ module ActionController "/**/#{options[:callback]}(#{json})" else - self.content_type ||= Mime[:json] + self.content_type = Mime[:json] if media_type.nil? json end end add :js do |js, options| - self.content_type ||= Mime[:js] + self.content_type = Mime[:js] if media_type.nil? js.respond_to?(:to_js) ? js.to_js(options) : js end add :xml do |xml, options| - self.content_type ||= Mime[:xml] + self.content_type = Mime[:xml] if media_type.nil? xml.respond_to?(:to_xml) ? xml.to_xml(options) : xml end end diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index e923afb17c..31df6cea0f 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -280,7 +280,7 @@ module ActionController #:nodoc: # Check for cross-origin JavaScript responses. def non_xhr_javascript_response? # :doc: - %r(\A(?:text|application)/javascript).match?(content_type) && !request.xhr? + %r(\A(?:text|application)/javascript).match?(media_type) && !request.xhr? end AUTHENTICITY_TOKEN_LENGTH = 32 |