Class: Splunk::Pickaxe::CookieProxy

Inherits:
Net::HTTP
  • Object
show all
Defined in:
lib/splunk/pickaxe/cookie_proxy.rb

Instance Method Summary collapse

Instance Method Details

#request(req, body = nil, &block) ⇒ Object

:yield: response



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/splunk/pickaxe/cookie_proxy.rb', line 8

def request(req, body = nil, &block)  # :yield: +response+
  if @@cookies 
    req['Cookie'] = @@cookies
  end
  r = super(req,body,&block)
  c = r.to_hash['set-cookie']
  if c 
    @@cookies = c.collect{|ea|ea[/^.*?;/]}.join
  end
  return r
end