diff --git a/lib/net/http.rb b/lib/net/http.rb index d5395767e8958b..d2f33d9d2e173c 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -200,6 +200,7 @@ class HTTPHeaderSyntaxError < StandardError; end # Net::HTTP::Head # Net::HTTP::Post # Net::HTTP::Put + # Net::HTTP::Patch # Net::HTTP::Proppatch # Net::HTTP::Lock # Net::HTTP::Unlock @@ -918,6 +919,12 @@ def put(path, data, initheader = nil) #:nodoc: res end + def patch(path, data, initheader = nil) #:nodoc: + res = request(Patch.new(path, initheader), data) + res.value unless @newimpl + res + end + # Sends a PROPPATCH request to the +path+ and gets a response, # as an HTTPResponse object. def proppatch(path, body, initheader = nil) @@ -1738,6 +1745,12 @@ class Put < HTTPRequest RESPONSE_HAS_BODY = true end + class Patch < HTTPRequest + METHOD = 'PATCH' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + class Delete < HTTPRequest METHOD = 'DELETE' REQUEST_HAS_BODY = false