summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/rack/deflater.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb
index 2e55f97e..36cfb7af 100644
--- a/lib/rack/deflater.rb
+++ b/lib/rack/deflater.rb
@@ -58,9 +58,9 @@ module Rack
       when "identity"
         [status, headers, body]
       when nil
-        body.close if body.respond_to?(:close)
         message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found."
-        [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]]
+        bp = Rack::BodyProxy.new([message]) { body.close if body.respond_to?(:close) }
+        [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, bp]
       end
     end