render :json with a callback shouldn't be Mime::JSON...

Correct me if I'm wrong, but if a callback is specified for render :json, the response is no longer json - it's javascript. Shouldn't the content type be set accordingly?

I'm experimenting with modifying the javascript response in an after_filter - for instance, I might append something along the lines of "Flash.show(#{flash[:notice]})" to display a flash regardless of whether the request was ajaxy or not. I could do the same with json by adding a 'flash' property to the json object, but only if I could be sure that the response really is pure json... hence this post.

test:

http://dev.rubyonrails.org/browser/trunk/actionpack/test/controller/render_test.rb?r=6517#L196

You’re right. JSON with a callback is no longer valid JSON, as far as I know.

Well, based on the 100% agreement rating so far, here's a patch: http://dev.rubyonrails.org/ticket/8062

Awesome - a swift consensus :wink: