about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-28 06:54:06 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-28 07:30:05 +0000
commit53afe0b23fc67c5b25541cddbd68f905c649e756 (patch)
tree0b8715aa2a662e5208320d552beb526d4162485f /lib
parent46d79be0ad3de48ef0a677537becb3508ccad31e (diff)
downloadrainbows-53afe0b23fc67c5b25541cddbd68f905c649e756.tar.gz
No need to wrap regular files
Diffstat (limited to 'lib')
-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)