Class: FormServlet

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



175
176
177
178
179
180
181
182
183
184
# File 'lib/mechanize/test_case.rb', line 175

def do_GET(req, res)
  res.body = "<HTML><body>"
  req.query.each_key { |k|
    req.query[k].each_data { |data|
      res.body << "<a href=\"#\">#{WEBrick::HTTPUtils.unescape(k)}:#{WEBrick::HTTPUtils.unescape(data)}</a><br />"
    }
  }
  res.body << "<div id=\"query\">#{res.query}</div></body></HTML>"
  res['Content-Type'] = "text/html"
end

#do_POST(req, res) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/mechanize/test_case.rb', line 186

def do_POST(req, res)
  res.body = "<HTML><body>"

  req.query.each_key { |k|
    req.query[k].each_data { |data|
      res.body << "<a href=\"#\">#{k}:#{data}</a><br />"
    }
  }

  res.body << "<div id=\"query\">#{req.body}</div></body></HTML>"
  res['Content-Type'] = "text/html"
end