End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Net::HTTP.post
post(url, data, header = nil)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/net/http.rb, line 514
def HTTP.post(url, data, header = nil)
start(url.hostname, url.port,
:use_ssl => url.scheme == 'https' ) {|http|
http.post(url, data, header)
}
end
Posts data to the specified URI object.
Example:
Example
require 'net/http' require 'uri' Net::HTTP.post URI('http://www.example.com/api/search'), { "q" => "ruby", "max" => "50" }.to_json, "Content-Type" => "application/json"