Public Class methods
new(options = {}, &blk)
[show source]
# File lib/httpx/plugins/cookies.rb 24 def initialize(options = {}, &blk) 25 super({ cookies: Jar.new }.merge(options), &blk) 26 end
Public Instance methods
build_request(*)
[show source]
# File lib/httpx/plugins/cookies.rb 41 def build_request(*) 42 request = super 43 request.headers.set_cookie(request.options.cookies[request.uri]) 44 request 45 end
make_jar(*args)
factory method to return a Jar to the user, which can then manipulate externally to the session.
[show source]
# File lib/httpx/plugins/cookies.rb 49 def make_jar(*args) 50 Jar.new(*args) 51 end
wrap()
[show source]
# File lib/httpx/plugins/cookies.rb 28 def wrap 29 return super unless block_given? 30 31 super do |session| 32 old_cookies_jar = @options.cookies.dup 33 begin 34 yield session 35 ensure 36 @options = @options.merge(cookies: old_cookies_jar) 37 end 38 end 39 end