From 123d3041f4d0f2620f16e7286dd6e76f324e6bd7 Mon Sep 17 00:00:00 2001 From: Wesley Beary Date: Sun, 11 Oct 2009 13:37:56 -0700 Subject: [PATCH] simplify connection.write when body is string --- lib/fog/connection.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/fog/connection.rb b/lib/fog/connection.rb index ab451b3a1..cf1294498 100644 --- a/lib/fog/connection.rb +++ b/lib/fog/connection.rb @@ -56,12 +56,11 @@ unless Fog.mocking? if params[:body] if params[:body].is_a?(String) - body = StringIO.new(params[:body]) + connection.write(params[:body]) else - body = params[:body] - end - while chunk = body.read(CHUNK_SIZE) - connection.write(chunk) + while chunk = params[:body].read(CHUNK_SIZE) + connection.write(chunk) + end end end