You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an ArgumentError when using the redmine_git_hosting plugin, specifically related to the http_post method invocation in call_webservices.rb.
Error Message:
ArgumentError (wrong number of arguments (given 2, expected 1)):
plugins/redmine_git_hosting/app/services/redmine_hooks/http_helper.rb:9:in `http_post'
Problem Details:
In the file call_webservices.rb, the method http_post is called with two positional arguments:
post_failed, post_message = send(use_method, post_receive_url.url, { data: { payload: payload } })
However, the http_post method in http_helper.rb is defined to accept one positional argument and keyword arguments:
def http_post(url, **opts)
RedmineGitHosting::Utils::Http.http_post url, **opts
end
Passing the data hash as a second positional argument leads to an ArgumentError in Ruby 2.7 and newer versions, due to changes in how keyword arguments are handled.
Cause:
Method Definition:
http_post expects one positional argument (url) and any number of keyword arguments (**opts).
Method Invocation:
The method is invoked with two positional arguments, the second being a hash intended as keyword arguments.
Proposed Solution:
Modify the method call in call_webservices.rb to pass the data hash as keyword arguments:
post_failed, post_message = send(use_method, post_receive_url.url, data: { payload: payload })
This change aligns with the method definition and resolves the ArgumentError.
The text was updated successfully, but these errors were encountered:
redmine_git_hosting/app/services/redmine_hooks/call_webservices.rb
Line 110 in 746493c
Hello,
I've encountered an ArgumentError when using the redmine_git_hosting plugin, specifically related to the http_post method invocation in call_webservices.rb.
Error Message:
Problem Details:
In the file call_webservices.rb, the method http_post is called with two positional arguments:
post_failed, post_message = send(use_method, post_receive_url.url, { data: { payload: payload } })
However, the http_post method in http_helper.rb is defined to accept one positional argument and keyword arguments:
Passing the data hash as a second positional argument leads to an ArgumentError in Ruby 2.7 and newer versions, due to changes in how keyword arguments are handled.
Cause:
Proposed Solution:
Modify the method call in call_webservices.rb to pass the data hash as keyword arguments:
post_failed, post_message = send(use_method, post_receive_url.url, data: { payload: payload })
This change aligns with the method definition and resolves the ArgumentError.
The text was updated successfully, but these errors were encountered: