Skip to content

Commit 870f7e9

Browse files
committed
Make changes <2.6 compatible
Multiple params to merge was not introduced until Ruby 2.6, so this merges the two additional params together first and then merges that with the request body
1 parent a68bfde commit 870f7e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/rubygems/gemcutter_utilities.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,14 @@ def sign_in(sign_in_host = nil, scope: nil)
165165
key_name = get_key_name(scope)
166166
scope_params = get_scope_params(scope)
167167
mfa_params = get_mfa_params(email, password)
168+
all_params = scope_params.merge(mfa_params)
169+
168170

169171
response = rubygems_api_request(:post, "api/v1/api_key",
170172
sign_in_host, scope: scope) do |request|
171173
request.basic_auth email, password
172174
request["OTP"] = otp if otp
173-
request.body = URI.encode_www_form({ name: key_name }.merge(scope_params, mfa_params))
175+
request.body = URI.encode_www_form({ name: key_name }.merge(all_params))
174176
end
175177

176178
with_response response do |resp|

0 commit comments

Comments
 (0)