Permalink
Browse files

Only set response etag if body is not blank

  • Loading branch information...
1 parent d91d6fe commit 2cd29f42979685188f4c248f716fc2e704e4a573 @jeremy jeremy committed Apr 10, 2010
Showing with 3 additions and 7 deletions.
  1. +2 −6 actionpack/lib/action_controller/response.rb
  2. +1 −1 actionpack/test/controller/render_test.rb
@@ -117,11 +117,7 @@ def etag?
end
def etag=(etag)
- if etag.blank?
- headers.delete('ETag')
- else
- headers['ETag'] = %("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}")
- end
+ headers['ETag'] = %("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}")
end
def redirect(url, status)
@@ -202,7 +198,7 @@ def handle_conditional_get!
def nonempty_ok_response?
ok = !status || status.to_s[0..2] == '200'
- ok && body.is_a?(String) && !body.empty?
+ ok && body.is_a?(String) && !body.blank?
end
def set_conditional_cache_control!
@@ -1609,7 +1609,7 @@ def test_render_against_etag_request_should_304_when_match
def test_render_against_etag_request_should_have_no_content_length_when_match
@request.if_none_match = etag_for("hello david")
get :render_hello_world_from_variable
- assert !@response.headers.has_key?("Content-Length"), @response.headers.inspect
+ assert_nil @response.headers["Content-Length"], @response.headers.inspect
end
def test_render_against_etag_request_should_200_when_no_match

0 comments on commit 2cd29f4

Please sign in to comment.