Class: RefreshWithEmptyUrl

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

Constant Summary collapse

@@count =
0

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mechanize/test_case/refresh_with_empty_url.rb', line 4

def do_GET(req, res)
  address = "#{req.host}:#{req.port}"

  res.content_type = "text/html"
  @@count += 1
  if @@count > 1
    res['Refresh'] = "0; url=http://#{address}/";
  else
    res['Refresh'] = "0; url=";
  end
end