…ack. Previously, if there was an error while ejecting the cassette, the cassette would remain as the current cassette. Closes #175.
- Add tests. - Move the body reading out of #vcr_request and into a helper method-- we don't want it to happen multiple times and #vcr_request is memoized for a reason. - Refactor the body reading a bit. - Use it for the response body, too. I don't really understand it, but for some reason the multipart request body becomes the response body when no HTTP adapter is set, and due to the change I made in d924f66, an error was raised. Closes #172.
…akeWeb). Previously, direct WebMock/FakeWeb/Typhoeus stubs would be ignored unless VCR was turned off. However, some users have requested that VCR use these stubs if they are set. This enables that. Part of this changes the VCR::Request::Typed interface a little bit; #stubbed? now returns true regardless of how it was stubbed, and #stubbed_by_vcr? should be used to test if VCR stubbed it (vs. #externally_stubbed?). Note that I consider this a bit experimental. I'm not sure I've thought through all the repercussions of this, and I consider this only "semi supported". Closes #146.
When the :redirects option is used with em-http-request, WebMock's after_request hook gets invoked twice for a single request. It appears to be doing it one for the original request and once for the following redirect request. However, the second time it does not actually have the new URL, and, furthermore, the globally_stub_request hook is only invoked once. As a result, the @__typed_vcr_request ivar has already been removed, and we were getting nil on the second after_request hook invocation. Our fix is to make our WebMock library hook tolerant of the @__typed_vcr_request hook not being present. Some things (such as filtering an after_http_request hook based on request type) will not work properly but the main VCR functionality can work this way. Closes #171.
Previously, we would get an error: TypeError: can't convert Fixnum into String Closes #167.