Class: Excon::Middleware::CaptureCookies
- Inherits:
-
Base
- Object
- Base
- Excon::Middleware::CaptureCookies
show all
- Defined in:
- lib/excon/middlewares/capture_cookies.rb
Instance Method Summary
collapse
Methods inherited from Base
#error_call, #initialize, #request_call, valid_parameter_keys
Instance Method Details
6
7
8
|
# File 'lib/excon/middlewares/capture_cookies.rb', line 6
def (set_cookie)
set_cookie.split(',').map { |full| full.split(';').first.strip }.join('; ')
end
|
10
11
12
13
14
15
|
# File 'lib/excon/middlewares/capture_cookies.rb', line 10
def (datum, )
_, = datum[:response][:headers].detect do |key, _|
key.casecmp?()
end
end
|
#response_call(datum) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/excon/middlewares/capture_cookies.rb', line 17
def response_call(datum)
cookie = (datum, 'Set-Cookie')
if cookie
cookie = (cookie)
unless datum[:headers].key?("Cookie")
datum[:headers]["Cookie"] = cookie
else
original_cookies = datum[:headers]["Cookie"]
datum[:headers]["Cookie"] = original_cookies.empty? ? cookie : [original_cookies,cookie].join('; ')
end
end
super(datum)
end
|