Clear cached webmock response in HTTPClient instance. #199

Merged
merged 1 commit into from Aug 14, 2012

Conversation

Projects
None yet
3 participants
Collaborator

myronmarston commented Aug 7, 2012

When the a request was not stubbed, the nil value of the webmock response was
being cached in the webmock_responses hash. Then, when a second request was
made with the same HTTPClient instance and an identical signature, it was not
checking for a stub again, even though there may have been one for the second request (e.g. when using a global stub hook or if another stub is registered between the 1st and 2nd requests).

Fixes myronmarston/vcr#190.

Clear cached webmock response in HTTPClient instance.
When the a request was not stubbed, the `nil` value of the webmock response was
being cached in the `webmock_responses` hash. Then, when a second request was 
made with the same HTTPClient instance and an identical signature, it was not 
checking for a stub again, even though there may have been one for the second request (e.g. when using a global stub hook or if another stub is registered between the 1st and 2nd requests).

Fixes myronmarston/vcr#190.

bblimke added a commit that referenced this pull request Aug 14, 2012

Merge pull request #199 from bblimke/vcr-issue-190
Clear cached webmock response in HTTPClient instance.

@bblimke bblimke merged commit 430f60d into master Aug 14, 2012

Owner

bblimke commented Aug 14, 2012

Thank you Myron. The fact that this code requires a comment to work, suggests there is a better way to do it.
I can't think of a better way though. There is a problem of a new response for the same signature being regiestered between two asynchronous requests and I don't know how to solve it differently.

I'm confused, has this fix actually been merged in? Will it be in the next WebMock patch release? I'm the original reporter over in VCR issue tracker, hoping a fix is in the release pipeline. Thanks!

Collaborator

myronmarston commented Aug 18, 2012

Yep, looks like it's in the 1.8.9 release:

v1.8.8...v1.8.9

Awesome, thanks to you both.

On Aug 18, 2012, at 4:35 PM, Myron Marston wrote:

Yep, looks like it's in the 1.8.9 release:

v1.8.8...v1.8.9


Reply to this email directly or view it on GitHub.

And I'd note for posterity that my original report, with reproducible
test case, did not involve any kind of asynchronous request, just
usual synchronous use of HTTPClient with WebMock (and VCR). Myron's
fix fixed my case though.

On Aug 18, 2012, at 4:35 PM, Myron Marston wrote:

Yep, looks like it's in the 1.8.9 release:

v1.8.8...v1.8.9


Reply to this email directly or view it on GitHub.

@davidbegin davidbegin deleted the vcr-issue-190 branch May 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment