mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-30 00:03:09 -04:00
Make Connection act enough like Builder to pass a Connection in to the
constructor block.
This commit is contained in:
parent
264759385f
commit
48cbbac378
@ -44,13 +44,31 @@ module Faraday
|
||||
proxy(options[:proxy])
|
||||
merge_params @params, options[:params] if options[:params]
|
||||
merge_headers @headers, options[:headers] if options[:headers]
|
||||
|
||||
if block
|
||||
@builder = Builder.create(&block)
|
||||
@builder = Builder.new
|
||||
@builder.build { block.call(self) }
|
||||
else
|
||||
@builder = options[:builder] || Builder.new
|
||||
end
|
||||
end
|
||||
|
||||
def use(klass, *args, &block)
|
||||
@builder.use(klass, *args, &block)
|
||||
end
|
||||
|
||||
def request(key, *args, &block)
|
||||
@builder.request(key, *args, &block)
|
||||
end
|
||||
|
||||
def response(key, *args, &block)
|
||||
@builder.response(key, *args, &block)
|
||||
end
|
||||
|
||||
def adapter(key, *args, &block)
|
||||
@builder.adapter(key, *args, &block)
|
||||
end
|
||||
|
||||
def build(options = {}, &block)
|
||||
@builder.build(options, &block)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user