about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/rainbows/dev_fd_response.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rainbows/dev_fd_response.rb b/lib/rainbows/dev_fd_response.rb
index 175978b..2f7b1cf 100644
--- a/lib/rainbows/dev_fd_response.rb
+++ b/lib/rainbows/dev_fd_response.rb
@@ -29,7 +29,11 @@ class Rainbows::DevFdResponse < Struct.new(:app)
     status, headers, body = response = app.call(env)
 
     # totally uninteresting to us if there's no body
-    return response if STATUS_WITH_NO_ENTITY_BODY.include?(status)
+    if STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) ||
+       File === body ||
+       (body.respond_to?(:to_path) && File.file?(body.to_path))
+      return response
+    end
 
     io = body.to_io if body.respond_to?(:to_io)
     io ||= File.open(body.to_path) if body.respond_to?(:to_path)