lib/rack/http_streaming_response.rb in rack-proxy-0.2.0 vs lib/rack/http_streaming_response.rb in rack-proxy-0.3.0

- old
+ new

@@ -24,15 +24,28 @@ def body self end + # Can be called only once! def each(&block) response.read_body(&block) ensure session.end_request_hacked end + + def to_s + @body ||= begin + lines = [] + + each do |line| + lines << line + end + lines.join + end + end + protected # Net::HTTPResponse def response @response ||= session.begin_request_hacked(@request)