Class: Net::HTTPResponse
- Inherits:
-
Object
- Object
- Net::HTTPResponse
- 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
-
#final_uri ⇒ Object
Returns the value of attribute final_uri.
Instance Method Summary collapse
-
#body ⇒ Object
New version of #body unzips a gzipped body before returning it Call GoGetter.get with the following in http_headers: “Accept-Encoding” => “gzip”).
- #body_asis ⇒ Object
Instance Attribute Details
#final_uri ⇒ Object
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
#body ⇒ Object
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_asis ⇒ Object
5 |
# File 'lib/go_getter/response.rb', line 5 alias :body_asis :body |