mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
(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:
parent
302d52a45e
commit
f6febc9b8f
8 changed files with 66 additions and 30 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue