Class: ResponseCodeServlet

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

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



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

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