Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from Mastercard/bugfix/remove_trailing_spaces
Browse files Browse the repository at this point in the history
Create correct auth header
  • Loading branch information
ech0s7r authored May 3, 2019
2 parents 0b66505 + 49ea8b1 commit a5d6890
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_authorization_string(oauth_params)
oauth_params.each {|entry|
entry_key = entry[0]
entry_val = entry[1]
header = "#{header}#{entry_key} = '#{entry_val}',"
header = "#{header}#{entry_key}=\"#{entry_val}\","
}
# Remove trailing ,
header.slice(0, header.length - 1)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_get_authorization_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_get_authorization_string
OAuth.stub(:time_stamp, "1524771555") do
oauth_params = OAuth.get_oauth_params consumer_key
authorization_string = OAuth.get_authorization_string oauth_params
assert_equal authorization_string, "OAuth oauth_consumer_key = 'aaa!aaa',oauth_nonce = 'uTeLPs6K',oauth_signature_method = 'RSA-SHA256',oauth_timestamp = '1524771555',oauth_version = '1.0'"
assert_equal authorization_string, 'OAuth oauth_consumer_key="aaa!aaa",oauth_nonce="uTeLPs6K",oauth_signature_method="RSA-SHA256",oauth_timestamp="1524771555",oauth_version="1.0"'
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion tests/test_oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_get_authorization_header
OAuth.stub(:sign_signature_base_string, "XXX") do
OAuth.stub(:time_stamp, "1524771555") do
header = OAuth.get_authorization_header uri, method, nil, consumer_key, signing_key
assert_equal header, "OAuth oauth_consumer_key = 'aaa!aaa',oauth_nonce = 'uTeLPs6K',oauth_signature_method = 'RSA-SHA256',oauth_timestamp = '1524771555',oauth_version = '1.0',oauth_signature = 'XXX'"
assert_equal header, 'OAuth oauth_consumer_key="aaa!aaa",oauth_nonce="uTeLPs6K",oauth_signature_method="RSA-SHA256",oauth_timestamp="1524771555",oauth_version="1.0",oauth_signature="XXX"'
end
end
end
Expand Down

0 comments on commit a5d6890

Please sign in to comment.