request_get(path, initheader = nil)
Instance Public methods
Sends a GET request to the path
. Returns the response as a Net::HTTPResponse object.
When called with a block, passes an HTTPResponse object to the block. The body of the response will not have been read yet; the block can process it using Net::HTTPResponse#read_body, if desired.
Returns the response.
This method never raises Net::* exceptions.
1 2 3 4 5 6 7 8 9 10 11 12 | response = http.request_get( '/index.html' ) # The entity body is already read in this case. p response[ 'content-type' ] puts response.body # Using a block http.request_get( '/index.html' ) {|response| p response[ 'content-type' ] response.read_body do |str| # read body now print str end } |
Please login to continue.