lib/sdk4me/client.rb in 4me-sdk-1.1.7 vs lib/sdk4me/client.rb in 4me-sdk-1.1.8
- old
+ new
@@ -209,10 +209,11 @@
# Expand the given header with the default header
def expand_header(header = {})
header = DEFAULT_HEADER.merge(header)
header['X-4me-Account'] = option(:account) if option(:account)
- header['AUTHORIZATION'] = 'Basic ' + ["#{option(:api_token)}:x"].pack('m*').gsub(/\s/, '')
+ token_and_password = option(:api_token).include?(':') ? option(:api_token) : "#{option(:api_token)}:x"
+ header['AUTHORIZATION'] = 'Basic ' + [token_and_password].pack('m*').gsub(/\s/, '')
if option(:source)
header['X-4me-Source'] = option(:source)
header['HTTP_USER_AGENT'] = option(:source)
end
header