Skip to content

Commit 239cd49

Browse files
committed
[request] Adds ruby version to user agent
1 parent 6765d55 commit 239cd49

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/razorpay/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(entity_name = nil)
1616
@entity_name = entity_name
1717
custom_headers = Razorpay.custom_headers || {}
1818
predefined_headers = {
19-
'User-Agent' => "Razorpay-Ruby/#{Razorpay::VERSION}"
19+
'User-Agent' => "Razorpay-Ruby/#{Razorpay::VERSION}; Ruby/#{RUBY_VERSION}"
2020
}
2121
# Order is important to give precedence to predefined headers
2222
headers = custom_headers.merge(predefined_headers)

test/razorpay/test_razorpay.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_custom_header
2222
stub_get(/$/, 'hello_response')
2323
Razorpay.headers = custom_headers
2424
Razorpay::Request.new('dummy').make_test_request
25-
user_agent = "Razorpay-Ruby/#{Razorpay::VERSION}"
25+
user_agent = "Razorpay-Ruby/#{Razorpay::VERSION}; Ruby/#{RUBY_VERSION}"
2626
headers = { 'User-Agent' => user_agent, 'Authorization' => 'Basic a2V5X2lkOmtleV9zZWNyZXQ=' }
2727
headers = headers.merge(custom_headers)
2828
assert_requested :get, 'https://api.razorpay.com/',
@@ -43,7 +43,7 @@ def test_sample_request
4343
def test_auth_header_and_user_agent
4444
stub_get(/$/, 'hello_response')
4545
Razorpay::Request.new('dummy').make_test_request
46-
user_agent = "Razorpay-Ruby/#{Razorpay::VERSION}"
46+
user_agent = "Razorpay-Ruby/#{Razorpay::VERSION}; Ruby/#{RUBY_VERSION}"
4747
headers = { 'User-Agent' => user_agent, 'Authorization' => 'Basic a2V5X2lkOmtleV9zZWNyZXQ=' }
4848
assert_requested :get, 'https://api.razorpay.com/',
4949
headers: headers,

0 commit comments

Comments
 (0)