Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Net::HTTPSession#request_query
request_query(path, data, initheader = nil) { |response| ... }
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/net/http.rb, line 2387
def request_query(path, data, initheader = nil, &block) # :yield: +response+
request Query.new(path, initheader), data, &block
end
Sends a QUERY request to the server; returns an instance of a subclass of Net::HTTPResponse.
The request is based on the Net::HTTP::Query object created from string path, string body, and initial headers hash initheader.
Example
http = Net::HTTP.new(hostname) http.query('/todos/1', 'xyzzy') # => #<Net::HTTPOK 200 OK readbody=true>
With no block given, returns the response object:
Example
http = Net::HTTP.new(hostname) http.request_query('/todos') # => #<Net::HTTPOK 200 OK readbody=true>
With a block given, calls the block with the response object and returns the response object:
Example
http.request_query('/todos') do |res| p res end # => #<Net::HTTPOK 200 OK readbody=true>
Output:
Example
#<Net::HTTPOK 200 OK readbody=false>