diff --git a/lib/final_redirect_url.rb b/lib/final_redirect_url.rb index c7cf525..76b8b26 100644 --- a/lib/final_redirect_url.rb +++ b/lib/final_redirect_url.rb @@ -25,6 +25,7 @@ def self.is_valid_url?(url) end def self.get_final_redirect_url(url, limit = 10) + return url if limit <= 0 uri = URI.parse(url) response = ::Net::HTTP.get_response(uri) if response.class == Net::HTTPOK