Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patron PATCH stub doesn't detect the body #750

Closed
iMacTia opened this issue Mar 15, 2018 · 3 comments
Closed

Patron PATCH stub doesn't detect the body #750

iMacTia opened this issue Mar 15, 2018 · 3 comments

Comments

@iMacTia
Copy link

iMacTia commented Mar 15, 2018

Hello, while updating our tests in Faraday, I noticed a strange behaviour from Patron.
It seems like when providing a body (data) to a patch call, the body gets discarded, hence WebMock raises an exception.
The some doesn't happen, however, for other methods including put.

At first I though Patron wasn't working properly, so I opened an issue there, but it turned out Patron is indeed sending the body correctly. So I suspect it's WebMock not detecting it properly.
Below a script to reproduce the issue (plus a working script with put method).

Patron version: 0.12.1
WebMock version: 3.3.0

Script to reproduce:

require 'patron'
require 'webmock'

include WebMock::API

WebMock.enable!

stub_request(:patch, "http://example.com/")
  .with(body: {"name"=>"zack"})

session = Patron::Session.new
session.patch('http://example.com', "name=zack")
# => Raises WebMock::NetConnectNotAllowedError

The same doesn't happen, however, if we use :put instead of :patch.

require 'patron'
require 'webmock'

include WebMock::API

WebMock.enable!

stub_request(:put, "http://example.com/")
  .with(body: {"name"=>"zack"})

session = Patron::Session.new
session.put('http://example.com', "name=zack")
# No exception raised
@bblimke
Copy link
Owner

bblimke commented Apr 29, 2018

@iMacTia thanks for reporting. This is now fixed in master.

@iMacTia
Copy link
Author

iMacTia commented Apr 30, 2018

Thanks @bblimke! Glad to know this was addressed!
I'll give it a try and feedback here as soon as possible.
Will also close the issue on successful feedback

@iMacTia
Copy link
Author

iMacTia commented May 3, 2018

@bblimke All tests green using master 🎉!
Thank you for fixing this 😄

@iMacTia iMacTia closed this as completed May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants