Class: InfiniteRedirectServlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- InfiniteRedirectServlet
- Defined in:
- lib/mechanize/test_case/infinite_redirect_servlet.rb
Instance Method Summary collapse
- #do_GET(req, res) ⇒ Object (also: #do_POST)
Instance Method Details
#do_GET(req, res) ⇒ Object Also known as: do_POST
3 4 5 6 7 8 |
# File 'lib/mechanize/test_case/infinite_redirect_servlet.rb', line 3 def do_GET(req, res) res['Content-Type'] = req.query['ct'] || "text/html" res.status = req.query['code'] ? req.query['code'].to_i : '302' number = req.query['q'] ? req.query['q'].to_i : 0 res['Location'] = "/infinite_redirect?q=#{number + 1}" end |