Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Net::HTTP#send_request

send_request(name, path, data = nil, header = nil)

Sends an HTTP request to the HTTP server. Also sends a DATA string if data is given.

Returns a Net::HTTPResponse object.

This method never raises Net::* exceptions.

Example
response = http.send_request('GET', '/index.html')
puts response.body