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
13 changes: 13 additions & 0 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,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 @@ -859,6 +860,12 @@ def put(path, data, initheader = nil) #:nodoc:
res
end

# Sends a PATCH request to the +path+ and gets a response,
# as an HTTPResponse object.
def patch(path, body, initheader = nil)
request(Patch.new(path, initheader), body)
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 @@ -1630,6 +1637,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