mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
allow for merging of default options from extended classes (important for passing along altered http classes)
This commit is contained in:
parent
930e654b51
commit
de35b9efad
@ -25,7 +25,10 @@ module HTTPX
|
||||
end
|
||||
|
||||
def plugin(*plugins)
|
||||
Class.new(Client).plugins(plugins).new
|
||||
klass = self.is_a?(Client) ? self.class : Client
|
||||
klass = Class.new(klass)
|
||||
klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
|
||||
klass.plugins(plugins).new
|
||||
end
|
||||
alias_method :plugins, :plugin
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user