From 53afe0b23fc67c5b25541cddbd68f905c649e756 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Dec 2010 06:54:06 +0000 Subject: dev_fd_response: pass files straight through No need to wrap regular files --- lib/rainbows/dev_fd_response.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3-24-ge0c7