Class: OneCookieServlet

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/mechanize/test_case/one_cookie_servlet.rb

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/mechanize/test_case/one_cookie_servlet.rb', line 3

def do_GET(req, res)
  cookie = WEBrick::Cookie.new("foo", "bar")
  cookie.path = "/"
  cookie.expires = Time.now + 86400
  res.cookies << cookie
  res['Content-Type'] = "text/html"
  res.body = "<html><body>hello</body></html>"
end