Skip to content

Commit

Permalink
Fix tests with excon >= 0.63 (vcr#809)
Browse files Browse the repository at this point in the history
* Fix tests with excon >= 0.63

In this version an 'Accept' header has been added in excon [1] and needs to be
added to the default headers to merge too. This should fix vcr#801 and with the
version check being backwards compatible

[1] https://github.com/excon/excon/blame/master/lib/excon/constants.rb#L141

* Update spec/support/http_library_adapters.rb

Prefer start_with() over to_f() for version comparison

Co-Authored-By: Kurtis Rainbolt-Greene <[email protected]>

* Use patch by @terceiro

Co-Authored-By: Olle Jonsson <[email protected]>

Co-authored-by: Kurtis Rainbolt-Greene <[email protected]>
Co-authored-by: Olle Jonsson <[email protected]>
  • Loading branch information
3 people authored Mar 30, 2020
1 parent ed3cacf commit 6cd7072
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/support/http_library_adapters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ def make_http_request(method, url, body = nil, headers = {})
end

def normalize_request_headers(headers)
headers.merge('User-Agent' => [Excon::USER_AGENT])
if Gem::Version.new(Excon::VERSION) < Gem::Version.new("0.63")
headers.merge('User-Agent' => [Excon::USER_AGENT])
else
headers.merge('User-Agent' => [Excon::USER_AGENT], 'Accept' => ['*/*'])
end
end
end

Expand Down

0 comments on commit 6cd7072

Please sign in to comment.