(maint) Use latest Faraday/webmock, update specs

This unpins Faraday and webmock, and updates specs so that the Faraday changes (primarily including auth in the header rather than in the URL) is reflected.
This commit is contained in:
Nick Burgan-Illig 2021-07-12 17:32:12 +00:00
parent 302d52a45e
commit f6febc9b8f
8 changed files with 66 additions and 30 deletions

View file

@ -2,6 +2,7 @@
require 'simplecov'
require 'coveralls'
require 'base64'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
@ -26,3 +27,19 @@ RSpec.configure do |config|
config.tty = true
config.formatter = :documentation
end
def get_headers(username: nil, password: nil, token: nil, content_type: nil, content_length: nil)
headers = {
'Accept' => '*/*',
'Accept-Encoding' => /gzip/,
'User-Agent' => /Faraday/,
}
if username && password
auth = Base64.encode64("#{username}:#{password}").chomp
headers['Authorization'] = "Basic #{auth}"
end
headers['X-Auth-Token'] = token if token
headers['Content-Type'] = content_type if content_type
headers['Content-Length'] = content_length.to_s if content_length
headers
end