aboutsummaryrefslogtreecommitdiffstats
path: root/test/webrick/test_filehandler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/webrick/test_filehandler.rb')
-rw-r--r--test/webrick/test_filehandler.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb
index 10b6add147..bdbd4e26fa 100644
--- a/test/webrick/test_filehandler.rb
+++ b/test/webrick/test_filehandler.rb
@@ -14,10 +14,15 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
end
def get_res_body(res)
- if defined? res.body.read
- res.body.read
+ body = res.body
+ if defined? body.read
+ begin
+ body.read
+ ensure
+ body.close
+ end
else
- res.body
+ body
end
end