Skip to content

Commit

Permalink
redmine api, use different get api in net:http
Browse files Browse the repository at this point in the history
* try to fix endless hang on certain hosts
  • Loading branch information
BuJo committed Jul 23, 2024
1 parent 80dbfea commit 08591c5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/buchungsstreber/redmine_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,12 @@ def post(path, dto)
def get(path, params = nil)
uri = URI.parse("#{@config['server']['url']}#{path}.json")
uri.query = URI.encode_www_form(params) if params
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true

header = {
"Accept" => "application/json",
"X-Redmine-API-Key" => @config["server"]["apikey"],
}
request = Net::HTTP::Get.new(uri, header)
result = https.request(request)
result = Net::HTTP.get_response(uri, header)
raise 'Unexpected result code' unless result.code == "200"

result.body.force_encoding("utf-8")
Expand Down

0 comments on commit 08591c5

Please sign in to comment.