aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-02 20:23:42 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-02 20:23:42 -0300
commitbeab403fc31199bbb01f1e6e1ba0f839af047afe (patch)
treee1bb44ddb80a2a5259f968a1ee3a7b78edbf6ef1 /actionpack/lib/action_controller
parentf2fc31473f0b0e7c8fe39156413b626358131543 (diff)
parentb00b638b95dc513f4ba854ba3a96b7a8f344e4cc (diff)
downloadrails-beab403fc31199bbb01f1e6e1ba0f839af047afe.tar.gz
rails-beab403fc31199bbb01f1e6e1ba0f839af047afe.tar.bz2
rails-beab403fc31199bbb01f1e6e1ba0f839af047afe.zip
Merge pull request #16026 from lucasmazza/lm-respond-to-jsonp-fix
Change the JSON renderer to enforce the 'JS' Content Type
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/renderers.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb
index 46405cef55..ae55e6d7f5 100644
--- a/actionpack/lib/action_controller/metal/renderers.rb
+++ b/actionpack/lib/action_controller/metal/renderers.rb
@@ -112,7 +112,10 @@ module ActionController
json = json.to_json(options) unless json.kind_of?(String)
if options[:callback].present?
- self.content_type ||= Mime::JS
+ if self.content_type.nil? || self.content_type == Mime::JSON
+ self.content_type = Mime::JS
+ end
+
"#{options[:callback]}(#{json})"
else
self.content_type ||= Mime::JSON