diff options
-rw-r--r-- | lib/rack/etag.rb | 2 | ||||
-rw-r--r-- | test/spec_etag.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/rack/etag.rb b/lib/rack/etag.rb index 99a1a4c0..fefe671f 100644 --- a/lib/rack/etag.rb +++ b/lib/rack/etag.rb @@ -28,7 +28,7 @@ module Rack body = Rack::BodyProxy.new(new_body) do original_body.close if original_body.respond_to?(:close) end - headers['ETag'] = %("#{digest}") if digest + headers['ETag'] = %(W/"#{digest}") if digest end unless headers['Cache-Control'] diff --git a/test/spec_etag.rb b/test/spec_etag.rb index b8b8b637..c075d9d0 100644 --- a/test/spec_etag.rb +++ b/test/spec_etag.rb @@ -21,13 +21,13 @@ describe Rack::ETag do should "set ETag if none is set if status is 200" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app).call(request) - response[1]['ETag'].should.equal "\"65a8e27d8879283831b664bd8b7f0ad4\"" + response[1]['ETag'].should.equal "W/\"65a8e27d8879283831b664bd8b7f0ad4\"" end should "set ETag if none is set if status is 201" do app = lambda { |env| [201, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app).call(request) - response[1]['ETag'].should.equal "\"65a8e27d8879283831b664bd8b7f0ad4\"" + response[1]['ETag'].should.equal "W/\"65a8e27d8879283831b664bd8b7f0ad4\"" end should "set Cache-Control to 'max-age=0, private, must-revalidate' (default) if none is set" do |