Class: Net::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/go_getter/go_getter.rb,
lib/go_getter/response.rb

Overview

Monkey-patch for Net::HTTPResponse This file isn’t required by the gem by default, so require it in your code

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#final_uriObject

Returns the value of attribute final_uri.



5
6
7
# File 'lib/go_getter/go_getter.rb', line 5

def final_uri
  @final_uri
end

Instance Method Details

#bodyObject

New version of #body unzips a gzipped body before returning it Call GoGetter.get with the following in http_headers: “Accept-Encoding” => “gzip”)



8
9
10
11
12
13
14
15
# File 'lib/go_getter/response.rb', line 8

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

#body_asisObject



5
# File 'lib/go_getter/response.rb', line 5

alias :body_asis :body