On this page
class Net::HTTP::Patch
Class for representing HTTP method PATCH:
require 'net/http'
uri = URI('http://example.com')
hostname = uri.hostname # => "example.com"
uri.path = '/posts'
req = Net::HTTP::Patch.new(uri) # => #<Net::HTTP::Patch PATCH>
req.body = '{"title": "foo","body": "bar","userId": 1}'
req.content_type = 'application/json'
res = Net::HTTP.start(hostname) do |http|
http.request(req)
end
Properties:
Request body: yes.
Response body: yes.
Safe: no.
Idempotent: no.
Cacheable: no.
Related:
Net::HTTP#patch
: sendsPATCH
request, returns response object.
Constants
- METHOD
- REQUEST_HAS_BODY
- RESPONSE_HAS_BODY
Ruby Core © 1993–2022 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.