Modifying the global configuration in before_http_request
is a bad idea because it'll affect every request made after you change the config, not just the ones matching example.com
. Here's how I would recommend you do this instead:
VCR.configure do |vcr|
uri_matcher = VCR.request_matchers[:uri]
vcr.register_request_matcher(:uri_ignoring_trailing_id_for_example_dot_com) do |req_1, req_2|
if req_1.parsed_uri.host == "example.com" && req_2.parsed_uri.host == "example.com"
# do your custom matching where you ignore trailing id
else
uri_matcher.matches?(req_1, req_2)
end
end
vcr.default_cassette_options = { match_requests_on: [:method, :uri_ignoring_trailing_id_for_example_dot_com] }
end