Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Skips Etag even if Cache-Control has a no-cache value together with o…

…ther options
  • Loading branch information...
commit d12743510a9fad7f2c8083b17f09ebf2c37bc281 1 parent 0fbb575
@fabiokr fabiokr authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/rack/etag.rb
  2. +1 −1  test/spec_etag.rb
View
2  lib/rack/etag.rb
@@ -46,7 +46,7 @@ def etag_body?(body)
end
def skip_caching?(headers)
- headers['Cache-Control'] == 'no-cache' ||
+ (headers['Cache-Control'] && headers['Cache-Control'].include?('no-cache')) ||
headers.key?('ETag') || headers.key?('Last-Modified')
end
View
2  test/spec_etag.rb
@@ -75,7 +75,7 @@ def res.to_path ; "/tmp/hello.txt" ; end
end
should "not set ETag if no-cache is given" do
- app = lambda { |env| [200, {'Cache-Control' => 'no-cache'}, ['Hello, World!']] }
+ app = lambda { |env| [200, {'Cache-Control' => 'no-cache, must-revalidate'}, ['Hello, World!']] }
response = Rack::ETag.new(app).call({})
response[1]['ETag'].should.be.nil
end
Please sign in to comment.
Something went wrong with that request. Please try again.