summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index e74c97f..d5bda88 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -45,11 +45,7 @@ class GitlabNet
def broadcast_message
resp = get("#{host}/broadcast_message")
- if resp.code == '200'
- JSON.parse(resp.body) rescue nil
- else
- nil
- end
+ JSON.parse(resp.body) rescue {}
end
def check
@@ -95,7 +91,7 @@ class GitlabNet
$logger.debug "Performing #{method.to_s.upcase} #{url}"
uri = URI.parse(url)
-
+
http = http_client_for(uri)
request = http_request_for(method, uri, params)
@@ -103,7 +99,7 @@ class GitlabNet
response = http.start { http.request(request) }
rescue => e
$logger.warn "Failed to connect to internal API <#{method.to_s.upcase} #{url}>: #{e.inspect}"
- raise ApiUnreachableError
+ raise ApiUnreachableError
end
if response.code == "200"