class SendCookiesServlet

Public Instance Methods

do_GET(req, res) click to toggle source
# File lib/mechanize/test_case/send_cookies_servlet.rb, line 2
  def do_GET(req, res)
    res.content_type = 'text/html'

    cookies = req.cookies.map do |c|
      "<li><a href=\"#\">#{c.name}:#{c.value}</a>"
    end.join "\n"

    res.body = <<-BODY
<!DOCTYPE html>
<title>Your cookies</title>

<ul>
#{cookies}
</ul>
    BODY
  end