test(vcr): automatically redact bearer tokens

This commit is contained in:
Colin Darie 2024-06-12 16:08:05 +02:00
parent 9d4113befb
commit 939bc37eab
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -4,4 +4,13 @@ VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/cassettes' c.cassette_library_dir = 'spec/fixtures/cassettes'
c.configure_rspec_metadata! c.configure_rspec_metadata!
c.ignore_hosts 'test.host', 'chromedriver.storage.googleapis.com' c.ignore_hosts 'test.host', 'chromedriver.storage.googleapis.com'
c.filter_sensitive_data('redacted') do |interaction|
auth = interaction.request.headers['Authorization']&.first
next if auth.nil?
if (match = auth.match(/^Bearer\s+([^,\s]+)/))
match.captures.first
end
end
end end