Session mixin, implements most of the APIs that the users call. delegates to a default session when extended.
Public Instance methods
accept(type)
returns a new session with the “Accept” header set to type.
[show source]
# File lib/httpx/chainable.rb 23 def accept(type) 24 with(headers: { "accept" => String(type) }) 25 end
plugin(pl, options = nil, &blk)
returns a new instance loaded with the pl plugin and options.
[show source]
# File lib/httpx/chainable.rb 33 def plugin(pl, options = nil, &blk) 34 klass = is_a?(S) ? self.class : Session 35 klass = Class.new(klass) 36 klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options)) 37 klass.plugin(pl, options, &blk).new 38 end
request(...)
delegates to the default session (see HTTPX::Session#request).
[show source]
# File lib/httpx/chainable.rb 18 def request(...) 19 branch(default_options).request(...) 20 end
with(options, &blk)
returns a new instance loaded with options.
[show source]
# File lib/httpx/chainable.rb 41 def with(options, &blk) 42 branch(default_options.merge(options), &blk) 43 end
wrap(&blk)
delegates to the default session (see HTTPX::Session#wrap).
[show source]
# File lib/httpx/chainable.rb 28 def wrap(&blk) 29 branch(default_options).wrap(&blk) 30 end