Method: Net::HTTP.get_print

Defined in:
lib/net/http.rb

.get_print(uri_or_host, path = nil, port = nil) ⇒ Object

Gets the body text from the target and outputs it to $stdout. The target can either be specified as (uri), or as (host, path, port = 80); so:

Net::HTTP.get_print URI('http://www.example.com/index.html')

or:

Net::HTTP.get_print 'www.example.com', '/index.html'


438
439
440
441
442
443
444
445
# File 'lib/net/http.rb', line 438

def HTTP.get_print(uri_or_host, path = nil, port = nil)
  get_response(uri_or_host, path, port) {|res|
    res.read_body do |chunk|
      $stdout.print chunk
    end
  }
  nil
end