Class: Net::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/rally_rest_api/rest_builder.rb

Instance Method Summary collapse

Instance Method Details

#plain_bodyObject

Return the uncompressed content



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rally_rest_api/rest_builder.rb', line 36

def plain_body
  encoding=self['content-encoding']
  content=nil
  if encoding then
    case encoding
      when 'gzip'
        i=Zlib::GzipReader.new(StringIO.new(self.body))
        content=i.read
      when 'deflate'
        i=Zlib::Inflate.new
        content=i.inflate(self.body)
      else
        raise "Unknown encoding - #{encoding}"
    end
  else
    content=self.body
  end
  return content
end