diff --git a/bin/metrics-nginx.rb b/bin/metrics-nginx.rb index 2985bdc..c93e739 100755 --- a/bin/metrics-nginx.rb +++ b/bin/metrics-nginx.rb @@ -95,17 +95,17 @@ def run request['Authorization'] = "Bearer #{config[:token]}" end response = http.request(request) - if response.code == '200' - found = true - elsif !response.header['location'].nil? - config[:url] = response.header['location'] - end else response = Net::HTTP.start(config[:hostname], config[:port]) do |connection| request = Net::HTTP::Get.new("/#{config[:path]}") connection.request(request) end end + if response.code == '200' + found = true + elsif !response.header['location'].nil? + config[:url] = response.header['location'] + end end # #YELLOW