You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using filter_sensitive_data with a value extracted dynamically from a query parameter, the cassette fails to replay, apparently because VCR is comparing the URL without substitution to the sanitized one.
There's a simple workaround, but in an ideal world it wouldn't be necessary:
diff --git a/spec/lib/vcr/configuration_spec.rb b/spec/lib/vcr/configuration_spec.rb
index 5e555e5..85701a9 100644
--- a/spec/lib/vcr/configuration_spec.rb+++ b/spec/lib/vcr/configuration_spec.rb@@ -158,6 +158,20 @@ RSpec.describe VCR::Configuration do
end
end
end
++ specify 'the filter_sensitive_data option works with dynamic query parameters' do+ VCR.configure do |c|+ c.filter_sensitive_data('<SECRET>') do |interaction|+ Rack::Utils.parse_query(URI(interaction.request.uri).query)['secret']+ end+ end++ 2.times do+ VCR.use_cassette("example") do+ ::Net::HTTP.get_response(URI("http://localhost:#{VCR::SinatraApp.port}/foo?secret=1234"))+ end+ end+ end
end
[:before_record, :before_playback].each do |hook_type|
I've tried fixing this but got lost in hooks...
The text was updated successfully, but these errors were encountered:
When using
filter_sensitive_data
with a value extracted dynamically from a query parameter, the cassette fails to replay, apparently because VCR is comparing the URL without substitution to the sanitized one.There's a simple workaround, but in an ideal world it wouldn't be necessary:
Here is a failing test case:
I've tried fixing this but got lost in hooks...
The text was updated successfully, but these errors were encountered: