Class: FaradayMiddleware::Gzip

Inherits:
Object
  • Object
show all
Defined in:
lib/builderator/patch/berkshelf.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#__uncompress_gzip__ ⇒ Object



9
# File 'lib/builderator/patch/berkshelf.rb', line 9

alias_method :__uncompress_gzip__, :uncompress_gzip

#uncompress_gzip(body) ⇒ Object



10
11
12
13
14
# File 'lib/builderator/patch/berkshelf.rb', line 10

def uncompress_gzip(body)
  __uncompress_gzip__(body)
rescue Zlib::GzipFile::Error
  StringIO.new(body).read
end