lib/yao/client.rb in yao-0.2.9 vs lib/yao/client.rb in yao-0.2.10
- old
+ new
@@ -44,18 +44,24 @@
def client_generator
Plugins::Registry.instance[:client_generator][Yao.config.client_generator].new
end
def gen_client(endpoint, token: nil)
- Faraday.new( endpoint ) do |f|
+ Faraday.new( endpoint, client_options ) do |f|
client_generator.call(f, token)
end
end
def reset_client(new_endpoint=nil)
set = ClientSet.new
set.register_endpoints("default" => {public_url: new_endpoint || Yao.config.endpoint})
self.default_client = set
+ end
+
+ def client_options
+ opt = {}
+ opt.merge!({ request: { timeout: Yao.config.timeout }}) if Yao.config.timeout
+ opt
end
end
Yao.config.param :auth_url, nil do |endpoint|
if endpoint