Sha256: c898196ba28ec390f5b185d064380da35527b725233cebb33f13654bdc829f37
Contents?: true
Size: 609 Bytes
Versions: 10
Compression:
Stored size: 609 Bytes
Contents
module Excon module Middleware class Decompress < Excon::Middleware::Base def response_call(datum) unless datum.has_key?(:response_block) case datum[:response][:headers]['Content-Encoding'] when 'deflate' # assume inflate omits header datum[:response][:body] = Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(datum[:response][:body]) when 'gzip' datum[:response][:body] = Zlib::GzipReader.new(StringIO.new(datum[:response][:body])).read end end @stack.response_call(datum) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems