Changelog

In git

2.0.0 (March 2, 2012)

Don't worry about stripping the standard port from the request URI on
playback. The standard port only needs to be stripped during recording;
for playback, it will have already been stripped. This allows people
to use the filter_sensitive_data option in a way that changes the URI;
before this change, doing so could result in URI::InvalidURIError.
Thanks to Patrick Schmitz and
Dan Thompson for reporting the issue
and helping diagnose it.

2.0.0 RC 2 (February 23, 2012)

New Features

Add YARD documentation for the public API. Thanks to
Ben Oakes for help with setting
this up.

Fix around_http_request hook so that request.proceed returns
the response.

Resolve cassette_library_dir to an absolute path. Thanks to
Nate Clark for the suggestion.

Add to the VCR::Request API in before_http_request and
after_http_request hooks so the request has query methods like
#real?, #recordable?, #ignored?, etc. Thanks to
Nate Clark for the idea.

Allow filters (objects that respond to #to_proc) to be passed
to before_http_request and after_http_request. This allows
an API like before_http_request(:real?) or
after_http_request(lambda { |req| req.uri =~ /amazon/ }).

Add debug_logger config option. This can be used to
troubleshoot what VCR is doing.

Update WebMock to version (1.8.0) that supports Excon stubbing.

Store the encoding with the request & response bodies in the
serialized cassette.

Add new preserve_exact_body_bytes option that base64 encodes the
request or response body in order to preserve the bytes exactly.
Thanks to Jeff Pollard for help
designing this feature and for code reviewing it.

Update to and require latest Excon (0.9.6).

Bug Fixes

Fix rspec metadata integration to allow the cassette name to be set
at the example group level and apply to multiple examples. Thanks to
Paul Russell for reporting the
bug.

Add missing require 'vcr/version' to the cassette migrator task.
If you tried the migration rake task with 2.0.0.rc1 and got a
NoMethodError, it should be fixed now.

Update Excon dependency to 0.9.5; 0.9.5 includes an important bug
fix needed by VCR.

Ensure the excon retry limit is honored properly.

Ensure that the correct error class is raised by excon when stubbing
an unexpected status.

Fix FakeWeb library hook so that it records the request body when
using Net::HTTP.post_form. Thanks to
Retistic for reporting the bug.

2.0.0 Beta 2 (November 6, 2011)

Fix a bug with VCR.request_matchers.uri_without_param(:some_param)
so that it properly handles URIs that have no parameters. Thanks to
Sathya Sekaran for this fix.

The cassette format has changed significantly:

The HTTPInteractions are no longer normalized in a lossy fashion.
VCR 1.x converted all HTTP header keys to lowercase. VCR 2.0 no
longer does this because it is impossible to know what the original
casing was (i.e. given etag, was it originally etag, ETag or
Etag?). Also, some HTTP libraries add particular request headers
to every request, and these used to be ignored. The aren't anymore.

The ruby struct objects are not directly serialized anymore.
Instead, only primitives (hashes, arrays, strings, integers) are
serialized. This allows swappable serializers and will allow other
tools to read and use a VCR cassette.

Add new serializer API. VCR ships with YAML, Syck, Psych and JSON
serializers, and it is very simple to implement your own. The
serializer can be configured on a per-cassette basis.

New vcr:migrate_cassettes DIR=path/to/cassettes rake task assists
with upgrading from VCR 1.x to 2.0.

Cassettes now contain a recorded_with attribute. This should
allow the cassette structure to be updated more easily in the future
as the version number provides a means for easily migrating
cassettes.

Add recorded_at to data serialized with an HTTPInteraction. This
allows the :re_record_interval cassette option to work more
accurately and no longer rely on the file modification time.

Note that VCR 1.x cassettes cannot be used with VCR 2.0. See the
upgrade notes for more info.

2.0.0 Beta 1 (October 8, 2011)

Changed

Previously, the last matching response in a cassette would
repeatedly playback if the same request kept being made. This is
no longer the case.

The Faraday middleware has been rewritten.

You no longer need to configure stub_with :faraday to use it.

It has been updated to work in parallel mode.

It no longer accepts a block and uses that to determine the
cassette. Instead, use VCR.use_cassette just like you would
with FakeWeb or WebMock.

Added

Allow any callable (an object that responds to #call, such as a
lambda) to be used as a request matcher. Thanks to Avdi Grimm
for the idea.

Add ability to register custom request matchers.

Add VCR.request_matchers.uri_without_param(:some_param) to generate
a request matcher that matches on URI but ignores the named parameter.

New :allow_playback_repeats cassette option preserves the old
playback repeat behavior. Thanks to Avdi Grimm
for the idea.

New :exclusive cassette option allows a cassette to be exclusively
used rather than keeping the existing one active as a fallback. Thanks
to Avdi Grimm for the idea.

Removed

Removed support for Ruby 1.8.6 and 1.9.1.

Removed lots of old deprecated APIs.

Removed support for manually changing the URI in a cassette to a regex.

Deprecated

Deprecated VCR.config in favor of VCR.configure.

Deprecated VCR::Config singleton module in favor of
VCR::Configuration class. The current configuration instance
can be accessed via VCR.configuration.

Deprecated stub_with in favor of hook_into. The stubbing
adapters have been completely rewritten and are no longer an
implementation of the adapter design pattern. Instead they simply
use the named library to globally hook into every HTTP request.

Fixed VCR/Net::HTTP/WebMock integration so that VCR no longer loads its Net::HTTP monkey patch when
WebMock is used, and relies upon WebMock's after_request callback to record Net::HTTP instead. This
fixes a bug when using WebMock and Open URI.

Consider 0.0.0.0 to be a localhost alias (previously only "localhost" and 127.0.0.1 were considered).

Added spec and feature coverage for Curb integration. Works out of the box with no changes required
to VCR due to Pete Higgins' great work to add Curb support to WebMock.

Got specs and features to pass on rubinius.

Changed WebMock version requirement to 1.4.0.

1.1.2 (September 9, 2010)

Fixed a minor bug with the WebMock integration: WebMock extends each Net::HTTPResponse with an extension
module after reading the body, and VCR was doing the same thing, leading to some slight deviance from
standard Net::HTTP behavior. The fix prevents VCR from adding the same extension to a Net::HTTPResponse
that has already been extende by WebMock.

Fixed a minor bug in the VCR::Net::HTTPResponse module so that it correctly handles nil bodies (such as
for a HEAD request).

Refactored VCR::Net::HTTPResponse module so it is implemented in a much simpler manner.

Updated specs and features so they pass against the latest WebMock release (1.3.5).

1.1.0 (August 22, 2010)

Removed VCR::TaskRunner and the corresponding rake task definition. The rake task migrated cassettes from the
0.3.1 format to the 0.4+ format. If you are still on 0.3.1 or earlier, I recommend you upgrade to 0.4.1 first,
migrate your cassettes and deal with migration warnings, then upgrade to the current release.

Added some code to VCR::Cassette.new to check the options passed to the cassette and raise an error if any
invalid options are passed.

Optimized ERB rendering a bit. Rather than creating a new struct subclass for each time we render an ERB
cassette with locals, we keep a cache of reusable struct subclasses based on the desired attributes.
Benchmarking reveals this is about 28% faster.

Upgraded tests to use em-http-request 0.2.10 rather than 0.2.7.

1.0.3 (August 5, 2010)

Updated VCR::CucumberTags so that it uses an around hook rather than a before hook and an after hook.
Around hooks were added to Cucumber in the 0.7.3 release, so you'll have to be on that version or higher to use
the VCR::CucumberTags feature.

Updated the WebMock version requirement to 1.3.3 or greater. 1.3.2 and earlier versions did not properly handle
multiple value for the same response header.

Miscellaneous documentation updates.

1.0.2 (July 6, 2010)

Fixed VCR to work with rest-client. Rest-client extends the Net::HTTP
response body string with a module containing additional data, which got serialized to the cassette file YAML
and occasionally caused problems when the YAML was deserialized. Bug reported by
Thibaud Guillaume-Gentil.

Setup bundler to manage development dependencies.

1.0.1 (July 1, 2010)

Fixed specs and features so they pass on MRI 1.9.2-preview3 and JRuby 1.5.1.

Normalized response and request headers so that they are stored the same (i.e. lower case keys, arrays of values)
in the cassette yaml files, regardless of which HTTP library is used. This is the same way Net::HTTP normalizes
HTTP headers.

Fixed VCR.use_cassette so that it doesn't eject a cassette if an exception occurs while inserting one.

Fixed FakeWeb adapter so that it works for requests that use basic auth. Patch submitted by
Eric Allam.

1.0.0 (June 22, 2010)

Added support for HTTPClient, Patron and
em-http-request when WebMock is used. Any future http libraries
WebMock supports should (theoretically, at least) work without any VCR code changes. Thanks to
Bartosz Blimke for adding the necessary code to WebMock to make this happen!

Added support for dynamic responses using ERB. A cassette will be evaluated as ERB before the YAML
is deserialized if you pass it an :erb => true option. You can pass variables using
:erb => { :var1 => 'some value', :var2 => 'another value' }.

Added ignore_localhost configuration setting, which defaults to false. Setting it true does the following:

Localhost requests will proceed as normal. The "Real HTTP connections are disabled" error will not occur.

Localhost requests will not be recorded.

Previously recorded localhost requests will not be replayed.

Exposed the version number:

VCR.version => string (in the format "major.minor.patch")

VCR.version.parts => array of integers

VCR.version.major => integer

VCR.version.minor => integer

VCR.version.patch => integer

Added test coverage and documentation of using a regex for non-deterministic URLs (i.e. URLs that include
a timestamp as a query parameter). It turns out this feature worked before, and I just didn't realize it :).

Breaking Changes

The :allow_real_http => lambda { |uri| ... } cassette option has been removed. There was no way to get
this to work with the newly supported http libraries without extensive monkeypatching, and it was mostly
useful for localhost requests, which is more easily handled by the new ignore_localhost config setting.

Removed methods and options that had been previously deprecated. If you're upgrading from an old version,
I recommend upgrading to 0.4.1 first, deal with all the deprecation warnings, then upgrade to 1.0.0.

0.4.1 May 11, 2010

Fixed a bug: when Net::HTTPResponse#read_body was called after VCR had read the body to record a new request,
it raised an error (IOError: Net::HTTPResponse#read_body called twice). My fix extends Net::HTTPResponse
so that it no longer raises this error.

0.4.0 April 28, 2010

Added support for webmock. All the fakeweb-specific code is now in an adapter (as is the webmock code).

Changed the format of the VCR cassettes. The old format was tied directly to Net::HTTP, but webmock supports
other HTTP libraries and I plan to allow VCR to use them in the future. Note that this is a breaking change--your
old VCR cassettes from prior releases will not work with VCR 0.4.0. However, VCR provides a rake task to assist
you in migrating your cassettes to the new format. Simply add load 'vcr/tasks/vcr.rake' to your project's Rakefile,
and run:

$ rake vcr:migrate_cassettes DIR=path/to/cassete/library/directory

The new cassette format records more information about the request (i.e. the request headers and body), so that it
can potentially be used with webmock in the future.

Made most of VCR::Cassette's methods private. I had forgotten to make the methods private before, and most of them
don't need to be exposed.

Automatically disallow http connections using the appropriate setting of the http stubbing library (fakeweb or webmock).
This relieves users from the need to set the option themselves, so they hopefully aren't using either fakeweb or webmock
directly, making it much easier to switch between these.

0.1.2 March 4, 2010

Got things to work for when a cassette records multiple requests made to the same URL with the same HTTP verb,
but different responses. We have to register an array of responses with fakeweb.

Fixed our Net::HTTP monkey patch so that it only stores the recorded response once per request.
Internally, Net::HTTP#request recursively calls itself (passing slightly different arguments) in certain circumstances.