Skip to content

Commit

Permalink
Added a check to see if the Patch class already exists in Net::HTTP (…
Browse files Browse the repository at this point in the history
…then we don't need this monkey patch)
  • Loading branch information
Syl Turner committed Jul 12, 2011
1 parent 14ab0a8 commit d4ac54b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/restclient/net_http_ext.rb
@@ -1,7 +1,8 @@
module Net
class HTTP
class HTTP

# Adding the patch method (rest-client issue: https://github.com/archiloque/rest-client/issues/79)
# Adding the patch method if it doesn't exist (rest-client issue: https://github.com/archiloque/rest-client/issues/79)
if !defined?(Net::HTTP::Patch)
# Code taken from this commit: https://github.com/ruby/ruby/commit/ab70e53ac3b5102d4ecbe8f38d4f76afad29d37d#lib/net/http.rb
class Protocol
# Sends a PATCH request to the +path+ and gets a response,
Expand Down Expand Up @@ -31,6 +32,7 @@ class Patch < HTTPRequest
REQUEST_HAS_BODY = true
RESPONSE_HAS_BODY = true
end
end

#
# Replace the request method in Net::HTTP to sniff the body type
Expand Down

0 comments on commit d4ac54b

Please sign in to comment.