Class: ResponseCodeServlet

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

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/mechanize/test_case.rb', line 474

def do_GET(req, res)
  res['Content-Type'] = req.query['ct'] || "text/html"
  if req.query['code']
    code = req.query['code'].to_i
    case code
    when 300, 301, 302, 303, 304, 305, 307
      res['Location'] = "/index.html"
    end
    res.status = code
  else
  end
end