read_body(dest = nil, &block)
Instance Public methods
Gets the entity body returned by the remote HTTP server.
If a block is given, the body is passed to the block, and the body is provided in fragments, as it is read in from the socket.
Calling this method a second or subsequent time for the same HTTPResponse object will return the value already read.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | http.request_get( '/index.html' ) {|res| puts res.read_body } http.request_get( '/index.html' ) {|res| p res.read_body.object_id # 538149362 p res.read_body.object_id # 538149362 } # using iterator http.request_get( '/index.html' ) {|res| res.read_body do |segment| print segment end } |
Please login to continue.