Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Net::HTTPSession#send_request
send_request(name, path, data = nil, header = nil)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/net/http.rb, line 2416
def send_request(name, path, data = nil, header = nil)
has_response_body = name != 'HEAD'
r = HTTPGenericRequest.new(name,(data ? true : false),has_response_body,path,header)
request r, data
end
Sends an HTTP request to the server; returns an instance of a subclass of Net::HTTPResponse.
The request is based on the Net::HTTPRequest object created from string path, string data, and initial headers hash header. That object is an instance of the subclass of Net::HTTPRequest, that corresponds to the given uppercase string name, which must be an HTTP request method or a WebDAV request method.
Examples:
Example
http = Net::HTTP.new(hostname) http.send_request('GET', '/todos/1') # => #<Net::HTTPOK 200 OK readbody=true> http.send_request('POST', '/todos', 'xyzzy') # => #<Net::HTTPCreated 201 Created readbody=true>