diff options
author | Prem Sichanugrist <s@sikac.hu> | 2014-01-31 15:37:58 -0500 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2014-02-18 12:08:36 -0500 |
commit | 103e18c87d50a53cd0a33b4e03f2c8a8eff19ece (patch) | |
tree | 07f0d46e80ea3dd978e4a6ca3e533087d76ca7f8 /actionpack/test/dispatch | |
parent | 6c496a6d2a21fb8f6f5fb4a97acf1f2de828d1d5 (diff) | |
download | rails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.tar.gz rails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.tar.bz2 rails-103e18c87d50a53cd0a33b4e03f2c8a8eff19ece.zip |
Introduce `render :body` for render raw content
This is an option for sending a raw content back to browser. Note that
this rendering option will unset the default content type and does not
include "Content-Type" header back in the response.
You should only use this option if you are expecting the "Content-Type"
header to not be set. More information on "Content-Type" header can be
found on RFC 2616, section 7.2.1.
Please see #12374 for more detail.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/response_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index 959a3bc5cd..26b77dfaf7 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -235,6 +235,14 @@ class ResponseTest < ActiveSupport::TestCase assert_equal @response.body, body.each.to_a.join end end + + test "does not add default content-type if Content-Type is none" do + resp = ActionDispatch::Response.new.tap { |response| + response.content_type = 'none' + } + + assert_not resp.headers.has_key?('Content-Type') + end end class ResponseIntegrationTest < ActionDispatch::IntegrationTest |