Skip to content

Commit

Permalink
Patron adapter handles PATCH requests with body.
Browse files Browse the repository at this point in the history
  • Loading branch information
bblimke committed Apr 29, 2018
1 parent 277da14 commit 5979ad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webmock/http_lib_adapters/patron_adapter.rb
Expand Up @@ -69,7 +69,7 @@ def self.build_request_signature(req)
uri = WebMock::Util::URI.heuristic_parse(req.url)
uri.path = uri.normalized_path.gsub("[^:]//","/")

if [:put, :post].include?(req.action)
if [:put, :post, :patch].include?(req.action)
if req.file_name
if !File.exist?(req.file_name) || !File.readable?(req.file_name)
raise ArgumentError.new("Unable to open specified file.")
Expand Down
7 changes: 7 additions & 0 deletions spec/acceptance/patron/patron_spec.rb
Expand Up @@ -19,6 +19,13 @@
@sess.base_url = "http://www.example.com"
end

it "should allow stubbing PATCH request with body" do
stub_request(:patch, "http://www.example.com/")
.with(body: "abc")

@sess.patch('/', "abc")
end

describe "file requests" do

before(:each) do
Expand Down

0 comments on commit 5979ad9

Please sign in to comment.