lib/cfoundry/rest_client.rb in cfoundry-0.5.1.rc1 vs lib/cfoundry/rest_client.rb in cfoundry-0.5.1.rc2
- old
+ new
@@ -66,10 +66,14 @@
private
def request_uri(method, uri, options = {})
uri = URI.parse(uri)
+ unless uri.is_a?(URI::HTTP)
+ raise InvalidTarget.new(@target)
+ end
+
# keep original options in case there's a redirect to follow
original_options = options.dup
payload = options[:payload]
if params = options[:params]
@@ -146,9 +150,11 @@
end
rescue ::Timeout::Error => e
raise Timeout.new(method, uri, e)
rescue SocketError, Errno::ECONNREFUSED => e
raise TargetRefused, e.message
+ rescue URI::InvalidURIError
+ raise InvalidTarget.new(@target)
end
def construct_url(path)
uri = URI.parse(path)
return path if uri.scheme