instance method
Net::HTTPSession#put
put(path, data, initheader = nil)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/net/http.rb, line 2119
def put(path, data, initheader = nil)
request(Put.new(path, initheader), data)
end
Sends a PUT request to the server; returns an instance of a subclass of Net::HTTPResponse.
The request is based on the Net::HTTP::Put object created from string path, string data, and initial headers hash initheader.
Example
data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' http = Net::HTTP.new(hostname) http.put('/todos/1', data) # => #<Net::HTTPOK 200 OK readbody=true>
Related:
-
Net::HTTP::Put: request class for HTTP method PUT. -
Net::HTTP.put: sends PUT request, returns response body.