lib/ridley/connection.rb in ridley-1.7.0 vs lib/ridley/connection.rb in ridley-1.7.1

- old
+ new

@@ -120,10 +120,12 @@ # # @param [String] target # a URL to stream the response body from # @param [String] destination # a location on disk to stream the content of the response body to + # + # @return [Boolean] true when the destination file exists def stream(target, destination) FileUtils.mkdir_p(File.dirname(destination)) target = Addressable::URI.parse(target) headers = Middleware::ChefAuth.authentication_headers( @@ -155,9 +157,10 @@ end local.flush FileUtils.cp(local.path, destination) + File.exists?(destination) rescue OpenURI::HTTPError => ex abort(ex) ensure local.close(true) unless local.nil? end