lib/etcd/client.rb in etcd-0.0.1 vs lib/etcd/client.rb in etcd-0.0.2

- old
+ new

@@ -9,11 +9,15 @@ attr_reader :host, :port, :http, :allow_redirect def initialize(opts={}) @host = opts[:host] || '127.0.0.1' @port = opts[:port] || 4001 - @allow_redirect = opts[:allow_redirect] || true + if opts.has_key?(:allow_redirect) + @allow_redirect = opts[:allow_redirect] + else + @allow_redirect = true + end end def version_prefix '/v1' end @@ -114,14 +118,14 @@ Log.debug("Http redirect, following") api_execute(res['location'], method, params) else Log.debug("Http error") Log.debug(res.body) - #res.error! - res + res.error! end end + private def redirect?(code) (code >= 300) and (code < 400) end end end