Sha256: 20ac269eb7e85b29f90d9074f77606000290f225bd78578a821633a78ebc0be3

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

# 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gogetter-0.1.1 lib/go_getter/response.rb
gogetter-0.1.0 lib/go_getter/response.rb