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

Same response from different request #703

Closed
dinhhuydh opened this issue May 30, 2017 · 1 comment
Closed

Same response from different request #703

dinhhuydh opened this issue May 30, 2017 · 1 comment

Comments

@dinhhuydh
Copy link

I currently use the Webmock 3.0.1 for vcr to stub external request. The issue is that the 2 different url requests return the same response so that the test is failed.
When vcr is not used, the test is passed. The requests are not in the same spec/scenario.
As i look at the code, Webmock implements class called Curl::WebMockCurlEasy which inherited the Curl::Easy. Although it does not override the reset method, somehow it does not clear out the @body_str of the previous request. The reset of Curl::Easy does clear out the variable. One notice is that the Curl::Easy instance is the same in the two requests.
Because the reset in the library is in C code so i can't go further.

If i apply the patch to clear out the body_str, it works well.

class Curl::WebMockCurlEasy
  def reset
    instance_variable_set('@body_str', nil)
    super
  end
end
@bblimke
Copy link
Owner

bblimke commented Jun 17, 2017

@dinhhuydh thank you for submitting the issue and providing a solution.

Would you fancy providing a pull request with that solution implemented?

oliakremmyda added a commit to oliakremmyda/webmock that referenced this issue Mar 7, 2018
oliakremmyda added a commit to oliakremmyda/webmock that referenced this issue Mar 8, 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