lib/rack/conditionalget.rb in rack-0.9.1 vs lib/rack/conditionalget.rb in rack-1.0.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'rack/utils'
+
module Rack
# Middleware that enables conditional GET using If-None-Match and
# If-Modified-Since. The application should set either or both of the
# Last-Modified or Etag response headers according to RFC 2616. When
@@ -22,9 +24,11 @@
status, headers, body = @app.call(env)
headers = Utils::HeaderHash.new(headers)
if etag_matches?(env, headers) || modified_since?(env, headers)
status = 304
+ headers.delete('Content-Type')
+ headers.delete('Content-Length')
body = []
end
[status, headers, body]
end