Class: Net::HTTPResponse
- Inherits:
-
Object
- Object
- Net::HTTPResponse
- Defined in:
- lib/quickbooks/util/http_encoding_helper.rb
Instance Method Summary collapse
-
#plain_body ⇒ Object
Return the uncompressed content.
Instance Method Details
#plain_body ⇒ Object
Return the uncompressed content
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/quickbooks/util/http_encoding_helper.rb', line 30 def plain_body encoding = self['Content-Encoding'] @_content ||= nil return @_content if @_content if encoding 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 @_content end |