module HTTPX::Plugins::Cookies::InstanceMethods

  1. lib/httpx/plugins/cookies.rb

Methods

Public Class

  1. new

Public Instance

  1. with_cookies
  2. wrap

Public Class methods

new (options = {}, &blk)
[show source]
   # File lib/httpx/plugins/cookies.rb
73 def initialize(options = {}, &blk)
74   super({ cookies: Store.new }.merge(options), &blk)
75 end

Public Instance methods

with_cookies (cookies)
[show source]
   # File lib/httpx/plugins/cookies.rb
77 def with_cookies(cookies)
78   branch(default_options.with_cookies(cookies))
79 end
wrap ()
[show source]
   # File lib/httpx/plugins/cookies.rb
81 def wrap
82   return super unless block_given?
83 
84   super do |session|
85     old_cookies_store = @options.cookies.dup
86     begin
87       yield session
88     ensure
89       @options = @options.with_cookies(old_cookies_store)
90     end
91   end
92 end