Skip to content

Commit

Permalink
Set the content-type to text/html if the options[:html] is true
Browse files Browse the repository at this point in the history
In this commit, we set the content-type to `text/html` in AbstractController if the `options[:html]` is true so that we don't include ActionView::Rendering into ActionController::Metal to set it properly.

I removed the if `options[:plain]` statement because `AbstractController#rendered_format` returns `Mime::TEXT` by default.
  • Loading branch information
akihiro17 committed Aug 28, 2015
1 parent cbe7899 commit 2de60a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/abstract_controller/rendering.rb
Expand Up @@ -23,8 +23,8 @@ module Rendering
def render(*args, &block)
options = _normalize_render(*args, &block)
self.response_body = render_to_body(options)
if options[:plain]
_set_content_type Mime::TEXT.to_s
if options[:html]
_set_content_type Mime::HTML.to_s
else
_set_content_type _get_content_type(rendered_format)
end
Expand Down
1 change: 0 additions & 1 deletion actionpack/test/controller/new_base/render_html_test.rb
Expand Up @@ -4,7 +4,6 @@ module RenderHtml
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
include ActionView::Rendering

def index
render html: "Hello World!"
Expand Down

0 comments on commit 2de60a9

Please sign in to comment.