Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added HTTP method PATCH.
  • Loading branch information
Isaac Sanders committed Apr 15, 2012
commit f2eba3c329e3b4cef847ef08563bfa3c4bf6a9c8
13 changes: 13 additions & 0 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down