Module: HTTPX::Plugins::Cookies::OptionsMethods

Defined in:
lib/httpx/plugins/cookies.rb

Overview

adds support for the following options:

:cookies

cookie jar for the session (can be a Hash, an Array, an instance of HTTPX::Plugins::Cookies::CookieJar)

Instance Method Summary collapse

Instance Method Details

#option_cookies(value) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/httpx/plugins/cookies.rb', line 85

def option_cookies(value)
  jar = value.is_a?(Jar) ? value : Jar.new(value)

  merge_cookie_in_jar(@headers.delete("cookie"), jar) if defined?(@headers) && @headers.key?("cookie")

  jar
end

#option_headersObject



77
78
79
80
81
82
83
# File 'lib/httpx/plugins/cookies.rb', line 77

def option_headers(*)
  value = super

  merge_cookie_in_jar(value.delete("cookie"), @cookies) if defined?(@cookies) && value.key?("cookie")

  value
end