diff options
author | Hongli Lai (Phusion <hongli@phusion.nl> | 2008-12-15 21:36:33 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-12-16 12:30:28 +0100 |
commit | 9e2b4a10f7f091868b3c3701efb4c04048455706 (patch) | |
tree | b7bfb7a80b78a22e5ab562a7d26c3d01abc7631d /actionpack/test | |
parent | 7c090509994faa19fcbd534aa78324b70b659627 (diff) | |
download | rails-9e2b4a10f7f091868b3c3701efb4c04048455706.tar.gz rails-9e2b4a10f7f091868b3c3701efb4c04048455706.tar.bz2 rails-9e2b4a10f7f091868b3c3701efb4c04048455706.zip |
Do not output an ETag header if response body is blank or when sending files with send_file(... :xsendfile => true) [#1578 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 9 | ||||
-rw-r--r-- | actionpack/test/controller/send_file_test.rb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 87733c2d33..a6721fd903 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -208,6 +208,10 @@ class TestController < ActionController::Base def greeting # let's just rely on the template end + + def blank_response + render :text => ' ' + end def layout_test render :action => "hello_world" @@ -1380,6 +1384,11 @@ class EtagRenderTest < ActionController::TestCase @request.host = "www.nextangle.com" @expected_bang_etag = etag_for(expand_key([:foo, 123])) end + + def test_render_blank_body_shouldnt_set_etag + get :blank_response + assert !@response.etag? + end def test_render_200_should_set_etag get :render_hello_world_from_variable diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb index c003abf094..ffbaa457f8 100644 --- a/actionpack/test/controller/send_file_test.rb +++ b/actionpack/test/controller/send_file_test.rb @@ -69,6 +69,7 @@ class SendFileTest < Test::Unit::TestCase assert_equal @controller.file_path, response.headers['X-Sendfile'] assert response.body.blank? + assert !response.etag? end def test_data |