aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-04-30 11:05:20 -0400
committerJon Moss <me@jonathanmoss.me>2017-04-30 11:05:20 -0400
commitf4b57b904dd4b6f6b4db6ff397cab23463890cc0 (patch)
tree350a41a5bc8a9fd519950e5350f9b58a3a3a5e31 /actionpack/test/controller/render_test.rb
parentda70168715c02980986279d60e3c6631cfb164d2 (diff)
downloadrails-f4b57b904dd4b6f6b4db6ff397cab23463890cc0.tar.gz
rails-f4b57b904dd4b6f6b4db6ff397cab23463890cc0.tar.bz2
rails-f4b57b904dd4b6f6b4db6ff397cab23463890cc0.zip
Default content type for `head` is `text/html`
Otherwise Mime::NullType will be returned as the `Content-Type` header.
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 3a0a0a8bde..313368eec4 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -227,6 +227,15 @@ class TestController < ActionController::Base
head 204
end
+ def head_default_content_type
+ # simulating path like "/1.foobar"
+ request.formats = []
+
+ respond_to do |format|
+ format.any { head 200 }
+ end
+ end
+
private
def set_variable_for_layout
@@ -759,6 +768,11 @@ class HeadRenderTest < ActionController::TestCase
get :head_and_return
end
end
+
+ def test_head_default_content_type
+ post :head_default_content_type
+ assert_equal "text/html", @response.header["Content-Type"]
+ end
end
class HttpCacheForeverTest < ActionController::TestCase