Skip to content

Commit

Permalink
fixup! Replace RestClient gem with HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
abotalov committed Aug 13, 2019
1 parent f94e004 commit c1ef1ec
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/reportportal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,22 @@ def send_request(verb, path, options = {})
options[:ssl_context].verify_mode = OpenSSL::SSL::VERIFY_NONE
end
uri = "#{Settings.instance.project_url}/#{path}"
HTTP.auth("Bearer #{Settings.instance.uuid}").request(verb, uri, options).parse
retries = 0
while retries < 3
begin
response = HTTP.auth("Bearer #{Settings.instance.uuid}").request(verb, uri, options)
return response.parse(:json) if response.status.success?

message = "Request to `#{uri}` returned code #{response.code}."
message << " Response:\n#{response}" unless response.to_s.empty?
puts message
retries += 1
rescue StandardError => e
puts "Request to `#{uri}` produced an exception:"
puts e
retries += 1
end
end
end
end
end

0 comments on commit c1ef1ec

Please sign in to comment.