diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-19 02:10:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-19 02:10:19 +0000 |
commit | 94fa0ed053a92b4dc48501d7dc7e7ebcec7e1ca6 (patch) | |
tree | 85194fe2927c771024336fa4ac5cb0cb9d642995 | |
parent | bd0cd043744c0aca38273de82f8b77d0e62ac5f6 (diff) | |
download | rails-94fa0ed053a92b4dc48501d7dc7e7ebcec7e1ca6.tar.gz rails-94fa0ed053a92b4dc48501d7dc7e7ebcec7e1ca6.tar.bz2 rails-94fa0ed053a92b4dc48501d7dc7e7ebcec7e1ca6.zip |
Its ETag not Etag
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6168 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-x | actionpack/lib/action_controller/response.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/render_test.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/response.rb b/actionpack/lib/action_controller/response.rb index 3a901cf351..22dc502395 100755 --- a/actionpack/lib/action_controller/response.rb +++ b/actionpack/lib/action_controller/response.rb @@ -44,10 +44,10 @@ module ActionController private def handle_conditional_get! if body.is_a?(String) && headers['Status'][0..2] == '200' && !body.empty? - self.headers['Etag'] ||= %("#{Digest::MD5.hexdigest(body)}") + self.headers['ETag'] ||= %("#{Digest::MD5.hexdigest(body)}") self.headers['Cache-Control'] = 'private' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control'] - if request.headers['HTTP_IF_NONE_MATCH'] == headers['Etag'] + if request.headers['HTTP_IF_NONE_MATCH'] == headers['ETag'] self.headers['Status'] = '304 Not Modified' self.body = '' end diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 495e48a34a..8c2b57084c 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -292,7 +292,7 @@ class RenderTest < Test::Unit::TestCase def test_render_200_should_set_etag get :render_hello_world_from_variable - assert_equal etag_for("hello david"), @response.headers['Etag'] + assert_equal etag_for("hello david"), @response.headers['ETag'] end def test_render_against_etag_request_should_304_when_match @@ -312,7 +312,7 @@ class RenderTest < Test::Unit::TestCase def test_render_with_etag get :render_hello_world_from_variable expected_etag = etag_for('hello david') - assert_equal expected_etag, @response.headers['Etag'] + assert_equal expected_etag, @response.headers['ETag'] @request.headers["HTTP_IF_NONE_MATCH"] = expected_etag get :render_hello_world_from_variable @@ -325,20 +325,20 @@ class RenderTest < Test::Unit::TestCase def render_with_404_shouldnt_have_etag get :render_custom_code - assert_nil @response.headers['Etag'] + assert_nil @response.headers['ETag'] end def test_etag_should_not_be_changed_when_already_set expected_etag = etag_for("hello somewhere else") - @response.headers["Etag"] = expected_etag + @response.headers["ETag"] = expected_etag get :render_hello_world_from_variable - assert_equal expected_etag, @response.headers['Etag'] + assert_equal expected_etag, @response.headers['ETag'] end def test_etag_should_govern_renders_with_layouts_too get :builder_layout_test assert_equal "<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", @response.body - assert_equal etag_for("<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n"), @response.headers['Etag'] + assert_equal etag_for("<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n"), @response.headers['ETag'] end |