Permalink
Browse files

Added 'ignore' to the trace if a response header was stripped

  • Loading branch information...
1 parent d668c88 commit 0ed9a12e4563dcf4e82a4e2543e0df862b22fbe2 @rmm5t rmm5t committed Feb 10, 2012
Showing with 6 additions and 0 deletions.
  1. +3 −0 lib/rack/cache/context.rb
  2. +3 −0 test/context_test.rb
View
3 lib/rack/cache/context.rb
@@ -272,9 +272,12 @@ def store(response)
# Remove all ignored response headers before writing to the cache.
def strip_ignore_headers(response)
+ stripped = false
ignore_headers.each do |name|
+ stripped ||= response.headers.delete(name)
response.headers.delete(name)
end
+ record :ignore if stripped
end
def log_error(exception)
View
3 test/context_test.rb
@@ -57,6 +57,7 @@
response.should.be.ok
cache.trace.should.include :miss
cache.trace.should.include :store
+ cache.trace.should.not.include :ignore
response.headers.should.include 'Age'
response.headers['Cache-Control'].should.equal 'public'
end
@@ -92,6 +93,7 @@
app.should.be.called
response.should.be.ok
cache.trace.should.include :store
+ cache.trace.should.include :ignore
response.headers['Set-Cookie'].should.be.nil
end
@@ -102,6 +104,7 @@
app.should.be.called
response.should.be.ok
cache.trace.should.not.include :store
+ cache.trace.should.not.include :ignore
response.headers['Set-Cookie'].should.equal 'TestCookie=OK'
end

0 comments on commit 0ed9a12

Please sign in to comment.