Sha256: 7e95f0d3f53205898bac566857b8c7c3eaf56002d51e8a77dded5f0044c84fcc

Contents?: true

Size: 670 Bytes

Versions: 12

Compression:

Stored size: 670 Bytes

Contents

# Monkey patch to handle the case where Content-Type headers returned by servers
# say "gzip" by the resulting message body isn't in gzip format.
# TODO Remove this when we upgrade Berkshelf and the gzip response goes away.
# https://github.com/berkshelf/berkshelf-api-client/blob/v1.3.0/lib/berkshelf/api_client/connection.rb#L37
require 'faraday_middleware'

module FaradayMiddleware
  class Gzip
    alias_method :__uncompress_gzip__, :uncompress_gzip
    def uncompress_gzip(body)
      __uncompress_gzip__(body)
    rescue Zlib::GzipFile::Error
      StringIO.new(body).read
    end
  end
end

Faraday::Response.register_middleware :gzip => FaradayMiddleware::Gzip

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
builderator-1.3.2 lib/builderator/patch/berkshelf.rb
builderator-1.3.1 lib/builderator/patch/berkshelf.rb
builderator-1.3.0 lib/builderator/patch/berkshelf.rb
builderator-1.2.3.pre.beta.1 lib/builderator/patch/berkshelf.rb
builderator-1.2.2 lib/builderator/patch/berkshelf.rb
builderator-1.2.1 lib/builderator/patch/berkshelf.rb
builderator-1.2.0 lib/builderator/patch/berkshelf.rb
builderator-1.1.12 lib/builderator/patch/berkshelf.rb
builderator-1.1.11 lib/builderator/patch/berkshelf.rb
builderator-1.1.10 lib/builderator/patch/berkshelf.rb
builderator-1.1.9 lib/builderator/patch/berkshelf.rb
builderator-1.1.8 lib/builderator/patch/berkshelf.rb