Public Class methods
new(options = {}, &blk)
[show source]
# File lib/httpx/plugins/cookies.rb 26 def initialize(options = {}, &blk) 27 super({ cookies: Jar.new }.merge(options), &blk) 28 end
Public Instance methods
build_request(*)
[show source]
# File lib/httpx/plugins/cookies.rb 43 def build_request(*) 44 request = super 45 request.headers.set_cookie(request.options.cookies[request.uri]) 46 request 47 end
wrap()
[show source]
# File lib/httpx/plugins/cookies.rb 30 def wrap 31 return super unless block_given? 32 33 super do |session| 34 old_cookies_jar = @options.cookies.dup 35 begin 36 yield session 37 ensure 38 @options = @options.merge(cookies: old_cookies_jar) 39 end 40 end 41 end