bugsnag / bugsnag-api-ruby

BugSnag API toolkit for Ruby
Other
21 stars 15 forks source link

Consider headers when VCR matches requests #37

Closed imjoehaines closed 2 years ago

imjoehaines commented 2 years ago

Goal

We need to change how auth works in order to support new Faraday versions (see https://github.com/bugsnag/bugsnag-api-ruby/pull/36), but the tests don't currently check the values of headers. This means that the auth headers could be wrong or missing entirely and the tests would still pass

This PR checks the headers that we set match between the cassette and the request made in the test (ignoring those set by Ruby/Faraday as they can change between versions). This showed that the basic auth header in the cassettes was already different to the actual header the specs used (the username:password combo didn't match)

The user agent header is special cased to avoid having to update it in every cassette for each release — we check it matches a regex with a version number, but the number can be different across requests

Changeset