Sha256: 742cc588f510e1b01834e247e984fc63fdf6f0bfda659197694d7b94b1bcd3df

Contents?: true

Size: 678 Bytes

Versions: 15

Compression:

Stored size: 678 Bytes

Contents

require 'faraday_middleware'

module FaradayMiddleware
  # 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
  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

15 entries across 15 versions & 1 rubygems

Version Path
builderator-1.0.4 lib/builderator/patch/berkshelf.rb
builderator-1.0.3 lib/builderator/patch/berkshelf.rb
builderator-1.0.2 lib/builderator/patch/berkshelf.rb
builderator-1.0.1 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.12 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.11 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.10 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.9 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.8 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.7 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.6 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.5 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.4 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.3 lib/builderator/patch/berkshelf.rb
builderator-1.0.0.pre.rc.1 lib/builderator/patch/berkshelf.rb