Method: Chef::REST#decompress_body

Defined in:
lib/chef/rest.rb

#decompress_body(response) ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/chef/rest.rb', line 210

def decompress_body(response)
  if gzip_disabled? || response.body.nil?
    response.body
  else
    case response[CONTENT_ENCODING]
    when GZIP
      Chef::Log.debug "decompressing gzip response"
      Zlib::Inflate.new(Zlib::MAX_WBITS + 16).inflate(response.body)
    when DEFLATE
      Chef::Log.debug "decompressing deflate response"
      Zlib::Inflate.inflate(response.body)
    else
      response.body
    end
  end
end