# Monkey-patch for Net::HTTPResponse # This file isn't required by the gem by default, so require it in your code class Net::HTTPResponse alias :body_asis :body # New version of #body unzips a gzipped body before returning it # Call GoGetter.get with the following in http_headers: "Accept-Encoding" => "gzip") def body if key?("Content-Encoding") and fetch("Content-Encoding") == "gzip" body_io = StringIO.new(body_asis) Zlib::GzipReader.new(body_io).read else body_asis end end end