Method: TingYun::TingYunService::Http#decompress_response

Defined in:
lib/ting_yun/ting_yun_service/http.rb

#decompress_response(response) ⇒ Object

Decompresses the response from the server, if it is gzip encoded, otherwise returns it verbatim



32
33
34
35
36
37
38
# File 'lib/ting_yun/ting_yun_service/http.rb', line 32

def decompress_response(response)
  if response['content-encoding'] == 'gzip'
    Zlib::GzipReader.new(StringIO.new(response.body)).read
  else
    response.body
  end
end