lib/ecoportal/api/common/response.rb in ecoportal-api-0.3.3 vs lib/ecoportal/api/common/response.rb in ecoportal-api-0.3.4

- old
+ new

@@ -3,11 +3,16 @@ module Common class Response attr_reader :status, :body def initialize(response) @status = response.status - @body = JSON.parse(response.to_s) rescue nil - response.flush + @body = [].tap do |body_data| + response.body.each do |chunk| + body_data << chunk + end + end.join("") + @body = JSON.parse(@body.to_s) rescue nil + response end def success? @status.success? end def print